Using the Execute Script Service in a Process

Within the set of the standard AEM Forms on JEE services available in AEM Forms on JEE Workbench, is the Execute Script service. This service lets you execute scripts in processes and provides the executeScript operation to do so.

Create an Application and a Process with the “Execute Script” Service Defined as an Activity

Overall application and process creation is out-of-scope for this tutorial, but for the sake of this instruction, an application named “DemoApplication02” has been created. Assuming that an application has already been created, you need to create a process in this application to call the executeScript service. To add a process to the application that includes the Execute Script service:

  1. Right-click your application and select New. In New slide-out menu, select Process. Name your process, add a description, if necessary, and select the icon you wish to represent this process. For the purposes of this tutorial, we have created a process and named it the executeScriptDemoProcess.
  2. Define your start points, or simple opt to add your start points later.
  3. The process is now created and should automatically open in the Process Design window. In this window, click the Activity Picker icon at the top of the Process Design window and drag the new activity onto the swim lane. At this point, the Define Activity Window should appear (see Figure below).
    Define Activity
  4. The executeScript service can be found under the Foundation set of services. The Services name lists the object as Execute Script – 1.0 with the Operation name executeScript. Click to select this item.
  5. This process should now be created, and by default the Process Properties window should appear in the pane on the left.