1. Create custom Data entity.
2. Add new method as shown for SUBMIT.
[SysODataActionAttribute("GetAzureSubmitl", false)]
public static str GetAzureSubmitl(PurchReqId purchReqId )
{
WorkflowVersionTable workflowVersionTable;
PurchReqTable _purchReqTable;
boolean submited = true;
PurchReqWorkflow purchReqWF;
select _purchReqTable where _purchReqTable.PurchReqId == purchReqId ; // with parameter value string.
workflowVersionTable = Workflow::findWorkflowConfigToActivateForType(workFlowTypeStr(PurchReqReview),
_purchReqTable.RecId,
_purchReqTable.TableId);
if (_purchReqTable.RecId
&& workflowVersionTable.RecId
&& _purchReqTable.RequisitionStatus == PurchReqRequisitionStatus::Draft)
{
if (PurchReqWFStatusTransitionHelper::setPurchReqTable2InReview(_purchReqTable.RecId))
{
Workflow::activateFromWorkflowType(workFlowTypeStr(PurchReqReview),
_purchReqTable.RecId,
"Submitted",
NoYes::No,
DirPersonUserEx::worker2UserId(_purchReqTable.Originator));
}
}
else
{
submited = false;
}
}
3. Save and build you project, you can see your method as an Action in Flow.
sample code for RECALL Purchase requisition workflow.
[SysODataActionAttribute("GetAzureRecall", false)]
public static str GetAzureRecall(PurchReqId purchReqId )
{
Code for RECALL
WorkflowCorrelationId workflowCorrelationId;
PurchReqTable purchReqTable;
boolean recalled = true;
select purchReqTable where purchReqTable.PurchReqId == purchReqId;//with parameter value string.
if(purchReqTable.RecId != 0 &&
purchReqTable.RequisitionStatus == PurchReqRequisitionStatus::InReview)
{
PurchReqWFStatusTransitionHelper::setPurchReqTable2Draft(purchReqTable.RecId);
workflowCorrelationId = Workflow::activateFromWorkflowType(workFlowTypeStr(PurchReqReview),
purchReqTable.RecId,
"Recalled by user",
NoYes::No,
DirPersonUserEx::worker2UserId(purchReqTable.Originator));
Workflow::cancelWorkflow(workflowCorrelationId,"Recalled by user");
}
else
{
recalled = false;
}
}