ECMA Scripts

The following objects are available (dependent on step type) within ECMA scripts:

MetaDataMaps

You can use workflow metadata to persist information that is required during the lifetime of the workflow. A common requirement of workflow steps is to persist data for future use in the workflow, or to retrieve the persisted data.

There are three types of MetaDataMap objects - for Workflow, WorkflowData and WorkItem objects. They all have the same intended purpose - to store metadata.

A WorkItem has its own MetaDataMap that can be only used while that workitem (e.g. step) is running.

Both Workflow and WorkflowData metadatamaps are shared over the entire workflow. For these cases it is recommended to only use the WorkflowData metadata map.

Creating Custom Workflow Step Components

Workflow step components can be created in the same manner as any other component.

To inherit from one of the (existing) base step components, add the following property to the cq:Component node:

  • Name: sling:resourceSuperType

  • Type: String

  • Value: One of the following paths that resolves to a base component:

    • cq/workflow/components/model/process
    • cq/workflow/components/model/participant
    • cq/workflow/components/model/dynamic_participant

Specifying the Default Title and Description for Step Instances

Use the following procedure to specify default values for the Title and Description fields on the Common tab.

NOTE
The field values appear on the step instance when both of the following requirements are satisfied:
  • The edit dialog of the step stores the title and description in the following locations: >

  • ./jcr:title

  • ./jcr:description locations

    This requirement is satisfied when the edit dialog uses the Common tab that the /libs/cq/flow/components/step/step component implements.

  • The step component or an ancestor of the component does not override the step.jsp script that the /libs/cq/flow/components/step/step component implements.

  1. Below the cq:Component node, add the following node:

    • Name: cq:editConfig
    • Type: cq:EditConfig
    NOTE
    For more information about the cq:editConfig node, see Configuring the Edit Behavior of a Component.
  2. Below the cq:EditConfig node, add the following node:

    • Name: cq:formParameters
    • Type: nt:unstructured
  3. Add String properties of the following names to the cq:formParameters node:

    • jcr:title: The value fills the Title field of the Common tab.
    • jcr:description: The value fills the Description field of the Common tab.