Job Action Services

   Journey Manager (JM) Previously known as Transact Manager (TM).  |    System Manager / DevOps  |  v5.1 & Higher This feature is related to v5.1 and higher.

Manager allows you to create and configure job action services. When a collaboration job's action is processed, an action service is run. A collaboration job usually specifies an action service from one of the available inbuilt action services. This allows a developer to create their own job action and job expiry services using GroovyGroovy is a powerful scripting language which runs on the Java Virtual Machine. Across theJourney platform, Groovy is used to create services in Manager. These services are primarily used to create plug-in style systems that interact with Manager. scripts.

To create a job action service:

  1. Select Services > Job Services.
  2. Click New to create a job service.
  3. Select the Job Action as a service type from the Service Type dropdown list.
  4. Select the Fluent Job Action template from the Service Template dropdown list.
  5. Select an organization from the Organization dropdown list.

    You have to assign a job controller to an organization. If you have several organizations that would like to use the same job controller, you need to define one for each organization.

  6. Click Save to update the changes.

To configure a job action service:

  1. Locate a job action service.
  2. Configure the service definition.
  3. Select the new service type to assign a Fluent or Groovy job action to a new type, such as Job Expiry Service or Job Task Wait.
  4. Configure the job definition. You can configure an action to call a Groovy service from a job controller, as shown below.
    "actions": [
              "name": "Individual Tasks",
              "type": "Job Task Assign",
              "properties": [
                { "name": "Task Assign Repeating",  "value": "true" },
                { "name": "Task Assign Repeat Item",  "value": "$func.invoke('Repeating Get Item', ${formDataMap.itemDelimited}, ${assignRepeatIndex})" },
                { "name": "Task Type",  "value": "Review" }
  5. The $func.invoke method executes the Repeating Get Item service (invoking it by the name) with two parameters.

  6. Click the Job Services tab to view the Repeating Get Item service used in the action definition.
  7. Click on the service name to open this service's Groovy script.
    import groovy.transform.TypeChecked
    import javax.servlet.http.*
    import org.apache.commons.lang3.StringUtils
    class FluentGroovyService {
        // Injected at runtime
        public Logger logger
         * Perform a groovy service invocation
         * return: the result object
        Object invoke(SvcDef svcDef, HttpServletRequest request, User user, Map params) {
            JobAction jobAction = (JobAction) params.jobAction
            return invoke(svcDef, request, user, jobAction, params)
        Object invoke(SvcDef svcDef, HttpServletRequest request, User user, JobAction jobAction, Map params) {
            List<String> args = (List<String>) params.args
            def result = "Not Found"
            if( StringUtils.isNotEmpty(args[0]) &&
               StringUtils.isNotEmpty(args[1]) &&
               args[1].isNumber()) {
                def itemDelimited = args[0]
                // note repeat index from TM is 1 based not 0 based
                def repeatIndex = args[1].toInteger() - 1
       "itemDelimited: " + itemDelimited
       "repeatIndex: " + repeatIndex
                def items = itemDelimited.tokenize('|')
       "items: " + items
                result = items[repeatIndex.toInteger()]
       "result Item: " + result
            return result
  8. Click Save to update the changes.

You can download the complete code example here.

Next, learn how to view all job services.