Team, I have an AEM workflow and it contains 4 Process Steps. After # process step 3, I want to run javascript code. Basically I want to execute JS code in middle of process step3 and process step4. Is there any other AEM workflow component available in this use case?
Solved! Go to Solution.
Views
Replies
Total Likes
@Mario248 you can call ECMA script from process step. Attaching screenshot for your reference to OOTB scripts, you can create custom script in apps/your-project and reference it.
Thanks
JS code executes in the browser console during and after the page load completes. The workflow transition from one step to another happens in the AEM Server side.
Yeah, I actually want to generate a PDF using javascript in middle of workflow. Just want to know if this is feasible.
If you want to run JavaScript for your requirement you can write ECMA script and call it from the process step.
Sample ECMA script example:
var workflowData = workItem.getWorkflowData();
if (workflowData.getPayloadType() == "JCR_PATH") {
// Write your custom code here.
var path = workflowData.getPayload().toString();
var node = workflowSession.getSession().getItem(path);
node.setProperty("approved", args[0] == "true" ? true : false);
node.save();
}
Thanks
Thank. I think I should go with ECMA script. But I see ECMA option only for "OR Split" component. I dont have any use case for OR Split. Is there any dedicated component for ECMA script ?
@Mario248 you can call ECMA script from process step. Attaching screenshot for your reference to OOTB scripts, you can create custom script in apps/your-project and reference it.
Thanks
Views
Likes
Replies
Views
Likes
Replies