Hi @racer3189
There are multiple ways to handle this case:
Approach I:
As stated by @raushan123 Basically in the next step of the workflow where you are either approving or rejecting it, one can created a process step for reading the args and then based on it perform the next steps
Sample code for reading the arguments and calling the service is
@Reference
ContentApprovalWorkflowService contentApprovalWorkflowService;
public void execute(WorkItem item, WorkflowSession session, MetaDataMap args) throws WorkflowException {
if (args.containsKey("PROCESS_ARGS")){
if(args.get("PROCESS_ARGS","string").toString().equalsIgnoreCase('Approved'){
contentApprovalWorkflowService.publish(payload);
}
contentApprovalWorkflowService.addLog(payload);
}
}
Approach II: Create seperate business logic and there is no need for reading the args.
Based on the selection from the participant or dynamic participant step the respective process step can be called which can call the service using the @Reference Annotation.
This approach is ideal when the processing logic for approval and rejection is complex and should be kept segregated.
Hope this helps!
Thanks