Friday, 24 May 2024

Workflow part-2(Custom Workflow Process and Custom Workflow Step )

Process step is allow us to execute ECMAScript or OSGI service.

  • Implement WorkflowProcess interface and override execute() method to create custom workflow process. Refer this URL to read more about workflow, model and its steps.
Follow below syntax to implement workflow process .



  • WorkItem: This contains workflow data as shown below.
  • WorkflowSession: It provides the complete capability to manage workflow models and instances. Workflow session allows us to provide complete on workflow model, items, active items, workflows(running, abort, completed).
  • MetaDataMap: It provide access to data map and arguments passed as an input.Process Step Implementation.
Process Step Implementation
  • Follow below step to create process and consume as part of workflow process.
1. Create a Java class. Implement WorkflowProcess interface and override execute method.


2. Create workflow model and process step to consume above created custom process step. Open URL and click on Models tile for navigating to Models section.


3. Click on Create button to create a brand new model.


4. Provide Title for workflow model and click on Done button.


5. Select newly created workflow model as click on Edit button to add workflow steps.

6. Click on Drag components here parsys to drag and drop step.
7. Select Process Step option.


8. Configure Process Step and provide above create custom step as part of step1.

9. Click on Sync will pick latest configurations from workflow model while execution.

10. Open any page to Start Workflow as shown below.


11. Select workflow created earlier as shown below and click on Start Workflow to start workflow execution.


12. It will call execute() method from CustomProcess.java class as soon as click on Start Workflow button.


14.In the repository, added pages have properties 'approval 1' and 'approval 2'.
Custom Workflow Step with dialog in aem


  • A custom workflow process is a backend module that can be individually deployed to AEM. Once you deploy this custom workflow process in AEM. it will be available inside a process step dropdown.
  • It does not have its own dialog. If you need to pass some values to this, you must use the existing dialog of the process step.
  • This is not applicable on the workflow model page.
  • If you want to create a custom workflow step, you need a component (only a dialog) and an editConfig node.
  • A custom workflow process is an individual module that does not need a custom workflow step to work; it can be deployed individually to AEM.
  • A custom workflow step needs a process and a custom workflow process



1.Go to Tools -> Workflow -> Models. Open Workflow Models.


2.create Custom Workflow step 





3.After created dialog

4.Set the path in open properties
5. 
Configure the Custom Workflow Step to add our Custom Step.


6. After authoring the Custom Workflow Step.
7. We found our dialog, which we created for the customized workflow component.

8.
Once done with configuring, Click on Sync at the top rightmost corner of the       screen to propagate the changes at Runtime.

    
9. Write a custom workflow process


10.
Your workflow is created. You can try running it.
11. 
In the Logger, print FirstName, LastName, and title.


12.You can see that your custom workflow process step is working properly, which is         why it shows in the archive.



Hope You can complete or step back the workflow step to take the necessary actions.

Thanks for reading
Matri Sharma


Quotes of the day
Just one small positive thought in the morning can change your whole day.


No comments:

Post a Comment

Servlet in AEM/Sling Servlet

  What is Servlet? A servlet is a Java class that runs on the server side where the application resides. It acts as a middle layer between t...