Please rate how useful you found this document: 
Average: 2.8 (4 votes)

Step Endpoints

A step is an action within a task, which can be a DynaForm, Input Document, Output Document or an External Step (which is created with a plugin). The following endpoints are available to manage steps in ProcessMaker:

Contents: [hide]
  1. Step Endpoints
    1. Get Steps for Task: GET /project/{prj_uid}/activity/{act_uid}/steps
    2. Get Available Steps for Task: GET /project/{prj_uid}/activity/{act_uid}/available-steps
    3. Get Step for Activity: GET /project/{prj_uid}/activity/{act_uid}/step/{step_uid}
    4. Assign Step to Task: POST /project/{prj_uid}/activity/{act_uid}/step
    5. Update Step for Activity: PUT /project/{prj_uid}/activity/{act_uid}/step/{step_uid}
    6. Unassign Step from Task: DELETE /project/{prj_uid}/activity/{act_uid}/step/{step_uid}
    7. Get Triggers for Step: GET /project/{prj_uid}/activity/{act_uid}/step/{step_uid}/triggers
    8. Get Available Triggers for Step: GET /project/{prj_uid}/activity/{act_uid}/step/{step_uid}/available-triggers/{type}
    9. Get Trigger for Step: GET /project/{prj_uid}/activity/{act_uid}/step/{step_uid}/trigger/{tri_uid}/{type}
    10. Assign Trigger to Step: POST /project/{prj_uid}/activity/{act_uid}/step/{step_uid}/trigger
    11. Update Trigger Assignment: PUT /project/{prj_uid}/activity/{act_uid}/step/{step_uid}/trigger/{tri_uid}
    12. Unassign Trigger from Step:
      DELETE /project/{prj_uid}/activity/{act_uid}/step/{step_uid}/trigger/{tri_uid}/{type}
    13. Get Triggers for Task: GET /project/{prj_uid}/activity/{act_uid}/step/triggers
    14. Available Triggers for Activity: GET /project/{prj_uid}/activity/{act_uid}/step/available-triggers/{type}
    15. Get Trigger for Activity: GET /project/{prj_uid}/activity/{act_uid}/step/trigger/{tri_uid}/{type}
    16. Assign a Trigger to Activity: POST /project/{prj_uid}/activity/{act_uid}/step/trigger
    17. Update Trigger: PUT /project/{prj_uid}/activity/{act_uid}/step/trigger/{tri_uid}
    18. Unassign Trigger: DELETE /project/{prj_uid}/activity/{act_uid}/step/trigger/{tri_uid}/{type}

Step resources:

Name Description Type Value
step_uidStep UIDString"9541049475298f190420f51086854718" (String of 32 characters)
step_type_objStep typeString"DYNAFORM" or "INPUT_DOCUMENT" or "OUTPUT_DOCUMENT" (unique values)
step_uid_objObject UIDString"9541049475298f190420f51086854718" (String of 32 characters)
step_conditionStep condition; it will only display if it evaluates to TRUEString"@@YEAR == 2013" (Alphanumeric string)
step_positionPosition that specifies the deployment step; starts at 1Integer1,2,.....
step_modeDisplay mode of the stepString"EDIT", "VIEW" (unique values)
obj_titleObject titleString"Title…" (Alphanumeric string)
obj_descriptionDescription of the objectString“Description…” (Alphanumeric string)
obj_uidObject UIDString"9541049475298f190420f51086854718" (String of 32 characters)
obj_titleObject titleString"Title…" (alphanumeric string)
obj_descriptionObject descriptionString"Description…" (alphanumeric string)
obj_typeStep typeString"DYNAFORM" or "INPUT_DOCUMENT" or "OUTPUT_DOCUMENT" (unique values)
tri_uidTrigger UIDString"287964159526013c6c64bb1071946215" (String of 32 characters)
tri_titleTrigger titleString"Title…" (Alphanumeric string)
tri_descriptionTrigger descriptionString"Description…" (Alphanumeric string)
st_typeType of trigger executionString"BEFORE_ASSIGNMENT", "BEFORE_ROUTING", "AFTER_ROUTING" (unique values)
st_conditionTrigger condition; the trigger will only be executed if the condition evaluates to trueString"@@YEAR == 2013" (Alphanumeric string)
st_positionPosition that specifies the order of execution of the trigger; it starts at 1IntegerString
tri_typeTrigger typeString"SCRIPT" (unique value)
tri_webbotTrigger codeString"$a = 1;" (Trigger code)
tri_param String

Get Steps for Task: GET /project/{prj_uid}/activity/{act_uid}/steps

Gets the list of the steps assigned to a task.

GET /api/1.0/{workspace}/project/{prj_uid}/activity/{act_uid}/steps

URL Parameters:

NameDescriptionExample
workspaceWorkspace name/api/1.0/workflow/project/113406514573f91fdd453d7080353209/activity/748962028577d84795d55b3012565154/steps
prj_uidUnique ID of the project (process), which can be obtained by examining the @@PROCESS system variable in the Debugger./api/1.0/workflow/project/113406514573f91fdd453d7080353209/activity/748962028577d84795d55b3012565154/steps
act_uidUnique ID of task, which can be obtained by examining the @@TASK system variable in the Debugger./api/1.0/workflow/project/113406514573f91fdd453d7080353209/activity/748962028577d84795d55b3012565154/steps

Result:

ElementDescription
[ An array of step objects.
{ First step object.
"step_uid": "800335382526013ee5406d6046561388",Unique ID of the step.
"step_type_obj": "DYNAFORM", Type of step, which can be "DYNAFORM", "INPUT_DOCUMENT", "OUTPUT_DOCUMENT" or "EXTERNAL" (a step created by a plugin).
"step_uid_obj": "480515388526013e03f5323091406324",Unique ID of the step's object, which can be a Dynaform, Input Document, Output Document or External Step.
"step_condition": "@@investigateClient == 'true'", A string containing the step's condition. If it evaluates to true, then the step will be executed.
"step_position": 1, The step position, where the first step in the task is 1, the second is 2, etc.
"step_mode": "EDIT", The mode, which can be "EDIT" or "VIEW". The BPMN Process Designer does not have a graphical option to use the "VIEW" mode.
"obj_title": "Background Check", The title of the step's object.
"obj_description":"Info about client's history", The description of the step's object.
"triggers": [ An array of triggers that are executed before or after the step.
{ First trigger object.
"tri_uid": "389005986576b14b28bac58020591119",The unique ID of the trigger.
"tri_title": "Lookup criminal history", The title of the trigger.
"tri_description":"Database searches on client", The description of the trigger.
"st_type": "BEFORE", The type of execution, which is "BEFORE" if executed before the step or "AFTER" if executed after the step.
"st_condition":"@@criminalHistory == 'yes'", A string containing the trigger's condition. If it evaluates to true, then the trigger will be executed.
"st_position": 1 The trigger's position, which is 1 for the first trigger, 2 for the second trigger, etc. There is separate counting for "BEFORE" and "AFTER" triggers.
}, End first trigger object.
... Any additional trigger objects.
] End array of trigger objects.
}, End first step object.
... Any additional step objects.
] End array of step objects.

Example:

Response

200 (OK)
Content-Type: application/json
[
  {
    "step_uid":        "800335382526013ee5406d6046561388",
    "step_type_obj":   "DYNAFORM",
    "step_uid_obj":    "480515388526013e03f5323091406324",
    "step_condition":  "@@investigateClient_label == 'true'",
    "step_position":   1,
    "step_mode":       "EDIT",
    "obj_title":       "Background Check",
    "obj_description": "Enter info to check client's history",
    "triggers":        [
      {
        "tri_uid":         "389005986576b14b28bac58020591119",
        "tri_title":       "Lookup criminal history",
        "tri_description": "Database searches for client's history",
        "st_type":         "BEFORE",
        "st_condition":    "@@criminalHistory == 'yes'",
        "st_position":     1
      },
      {
        "tri_uid":         "604830947578697355a2fc5053242432",
        "tri_title":       "Get User Info",
        "tri_description": "Get user's first and last names",
        "st_type":         "BEFORE",
        "st_condition":    "",
        "st_position":     2
      }
    ]
  },
  {
    "step_uid":        "9541049475298f190420f51086854718",
    "step_type_obj":   "INPUT_DOCUMENT",
    "step_uid_obj":    "71338434552669fb805d633062769307",
    "step_condition":  "",
    "step_position":   2,
    "step_mode":       "EDIT",
    "obj_title":       "History Files",
    "obj_description": "Upload any files about client's history",
    "triggers":        []
  },
  {
    "step_uid":        "79726484157869604c00b67078098592",
    "step_type_obj":   "OUTPUT_DOCUMENT",
    "step_uid_obj":    "71338434552669fb805d633062769307",
    "step_condition":  "",
    "step_position":   3,
    "step_mode":       "EDIT",
    "obj_title":       "Printout of Client's History",
    "obj_description": "",
    "triggers":        []
  }
]

PHP Example:

Find the unique ID of the step that holds the "Criminal history" Dynaform.

$formTitle = 'Criminal history';
$processId = '113406514573f91fdd453d7080353209';
$taskId =    '6537449955772ec4b9705a4019286874';
$url = "/api/1.0/workflow/project/$processId/activity/$taskId/steps";
$oRet = pmRestRequest("GET", $url);

if (isset($oRet->status) and $oRet->status == 200) {
   $stepId = '';
   //search for the ID of the step:
   foreach ($oRet->response as $oStep) {
      if ($oStep->obj_title == $formTitle) {
         $stepId = $oStep->step_uid;
         break;
      }
   }

   if (empty($stepId)) {
      throw new Exception("DynaForm '$formTitle' is not assigned as a step.");
   }
}

Get Available Steps for Task: GET /project/{prj_uid}/activity/{act_uid}/available-steps

Gets the list of available steps that may be assigned to a task.

GET /api/1.0/{workspace}/project/{prj_uid}/activity/{act_uid}/available-steps

URL Parameters:

NameDescriptionExample
workspaceWorkspace name/api/1.0/workflow/project/113406514573f91fdd453d7080353209/activity/748962028577d84795d55b3012565154/steps
prj_uidUnique ID of the project (process), which can be obtained by examining the @@PROCESS system variable in the Debugger./api/1.0/workflow/project/113406514573f91fdd453d7080353209/activity/748962028577d84795d55b3012565154/steps
act_uidUnique ID of task, which can be obtained by examining the @@TASK system variable in the Debugger./api/1.0/workflow/project/113406514573f91fdd453d7080353209/activity/748962028577d84795d55b3012565154/steps

Result:

ElementDescription
[ An array of available objects.
{ First object.
"obj_uid": "800335382526013ee5406d6046561388",Unique ID of the object.
"obj_title": "Background Check", The title of the object.
"obj_description":"Info about client's history", The description of the object.
"obj_type": "DYNAFORM" The type of object, which can be "DYNAFORM", "INPUT_DOCUMENT", "OUTPUT_DOCUMENT" or "EXTERNAL" (a custom step created by a plugin).
}, End first object.
... Any additional objects.
] End array of available objects.

Example:

Response

200 (OK)
Content-Type: application/json
[
  {
    "obj_uid":         "2074240775261579834c597006169172",
    "obj_title":       "Background Check",
    "obj_description": "Info about client's history",
    "obj_type":        "DYNAFORM"
  },
  {
    "obj_uid":         "86369594352602caa32c5c3004407686",
    "obj_title":       "Printout of Client's History",
    "obj_description": "outputdoc1 description",
    "obj_type":        "OUTPUT_DOCUMENT"
  }
]

PHP Example:

Search for an available Input Document that has the title "History Files" and assign it as a step in the task:

$inpDocTitle = "History Files";
$processId = '113406514573f91fdd453d7080353209';
$taskId =    '6537449955772ec4b9705a4019286874';
$url = "/api/1.0/workflow/project/$processId/activity/$taskId/available-steps";
$oRet = pmRestRequest("GET", $url);

if (isset($oRet->status) and $oRet->status == 200) {
   //search for the ID of the step:
   foreach ($oRet->response as $oStep) {
      if ($oStep->obj_title == $inpDocTitle) {
         $aParams = array(
            "step_type_obj" => $oStep->obj_type,
            "step_uid_obj"  => $oStep->obj_uid,
            "step_condition"=> '',
            "step_position" => 1,
            "step_mode"     => 'EDIT'
         );
         $url = "/api/1.0/workflow/project/$processId/activity/$taskId/step";
         $oRet = pmRestRequest("POST", $url, $aParams);
      }
   }
}

Get Step for Activity: GET /project/{prj_uid}/activity/{act_uid}/step/{step_uid}

Gets a single step assigned to an activity.

GET /api/1.0/{workspace}/project/{prj_uid}/activity/{act_uid}/step/{step_uid}

URL Parameters:

NameDescriptionExample
workspaceWorkspace name /api/1.0/workflow/project/113406514573f91fdd453d7080353209/ activity/748962028577d84795d55b3012565154/ step/28191616657869600330ad8022614695
prj_uidUnique ID of the project (process), which can be obtained by examining the @@PROCESS system variable in the Debugger. /api/1.0/workflow/project/113406514573f91fdd453d7080353209/ activity/748962028577d84795d55b3012565154/ step/28191616657869600330ad8022614695
act_uidUnique ID of task, which can be obtained by examining the @@TASK system variable in the Debugger. /api/1.0/workflow/project/113406514573f91fdd453d7080353209/ activity/748962028577d84795d55b3012565154/ step/28191616657869600330ad8022614695
step_uidUnique ID of the step. /api/1.0/workflow/project/113406514573f91fdd453d7080353209/ activity/748962028577d84795d55b3012565154/ step/28191616657869600330ad8022614695

Result:

ElementDescription
{ Step object.
"step_uid": "800335382526013ee5406d6046561388",Unique ID of the step.
"step_type_obj": "DYNAFORM", Type of step, which can be "DYNAFORM", "INPUT_DOCUMENT", "OUTPUT_DOCUMENT" or "EXTERNAL" (a step created by a plugin).
"step_uid_obj": "480515388526013e03f5323091406324",Unique ID of the step's object, which can be a Dynaform, Input Document, Output Document or External Step.
"step_condition": "@@investigateClient == 'true'", A string containing the step's condition. If it evaluates to true, then the step will be executed.
"step_position": 1, The step position, where the first step in the task is 1, the second is 2, etc.
"step_mode": "EDIT", The mode, which can be "EDIT" or "VIEW". The BPMN Process Designer does not have a graphical option to use the "VIEW" mode.
"obj_title": "Background Check", The title of the step's object.
"obj_description":"Info about client's history" The description of the step's object.
} End step object.

Example:

Response

200 (OK)
Content-Type: application/json
{
   "step_uid":       "800335382526013ee5406d6046561388",
   "step_type_obj":  "DYNAFORM",
   "step_uid_obj":   "480515388526013e03f5323091406324",
   "step_condition": "@%decision == 1",
   "step_position":  1,
   "step_mode":      "EDIT",
   "obj_title":      "Invoice Details",
   "obj_description":"Enter invoice information"
}

Assign Step to Task: POST /project/{prj_uid}/activity/{act_uid}/step

Assigns a step to a task.

Permission:

Users must have the PM_FACTORY permission assigned to their role to perform this action.

Structure:

POST /api/1.0/{workspace}/project/{prj_uid}/activity/{act_uid}/step

URL Parameters:

NameDescriptionExample
workspaceWorkspace name /api/1.0/workflow/project/113406514573f91fdd453d7080353209/activity/748962028577d84795d55b3012565154/step
prj_uidUnique ID of the project (process), which can be obtained by examining the @@PROCESS system variable in the Debugger. /api/1.0/workflow/project/113406514573f91fdd453d7080353209/activity/748962028577d84795d55b3012565154/step
act_uidUnique ID of task, which can be obtained by examining the @@TASK system variable in the Debugger. /api/1.0/workflow/project/113406514573f91fdd453d7080353209/activity/748962028577d84795d55b3012565154/step

POST Parameters:

Example parameterDescription
{
"step_type_obj": "DYNAFORM", Type of step, which can be "DYNAFORM", "INPUT_DOCUMENT", "OUTPUT_DOCUMENT" or "EXTERNAL" (a step created by a plugin).
"step_uid_obj": "480515388526013e03f5323091406324",Unique ID of the step's object, which can be a Dynaform, Input Document, Output Document or External Step.
"step_mode": "EDIT", For classic processes imported or upgraded from ProcessMaker 2. The mode can be "EDIT" or "VIEW" for Dynaforms, "ATTACH" or "VIEW" for Input Documents, and "EDIT" for Output Documents. For BPMN processes, the mode is not used and should always be set to "EDIT".
"step_condition": "@@investigateClient == 'true'", Optional. A string containing a PHP condition, which can contain case and system variables. If it evaluates to true, then the step will be executed. If it evaluates to false, then it won't be executed. If the expression consists of a single value, remember that in PHP a non-zero number and a non-empty string are considered true.
"step_position": 1, Optional. The step position, where the first step in the task is 1, the second is 2, etc. If an object is already in that position, then it will be displaced downward in the step order. If not included, then the object will be placed as the last step in the task.
}

Result:

If successful, the HTTP status code is set to 201 (Created) and an object is returned with information about the new step.

Example:

Request

Content-Type: application/json
{
  "step_type_obj":  "DYNAFORM",
  "step_uid_obj":   "761754168526157a5878337086391024",
  "step_mode":      "EDIT"
}

Response

201 (Created)
Content-Type: application/json
{
  "step_uid":       "31837094552a22139832435036743289",
  "step_type_obj":  "DYNAFORM",
  "step_uid_obj":   "761754168526157a5878337086391024",
  "step_mode":      "EDIT",
  "step_position":  2
}

PHP Example:

Assign a Dynaform as the last step in the task:

$processId = '113406514573f91fdd453d7080353209';
$taskId =    '6537449955772ec4b9705a4019286874';
$formId =    '761754168526157a5878337086391024';
$aParams = array(
   "step_type_obj" => 'DYNAFORM',
   "step_uid_obj"  => $formId,
   "step_mode"     => 'EDIT'
);
$url = "/api/1.0/workflow/project/$processId/activity/$taskId/step";
$oRet = pmRestRequest("POST", $url, $aParams);

if (isset($oRet->status) and $oRet->status == 201) {
   $stepId = $oRet->response->step_uid;
   $stepPosition = $oRet->response->step_position;
}

Update Step for Activity: PUT /project/{prj_uid}/activity/{act_uid}/step/{step_uid}

Updates the assignment of a step to an activity.

Permission:

Users must have the PM_FACTORY permission assigned to their role to perform this action.

Structure:

PUT /api/1.0/{workspace}/project/{prj_uid}/activity/{act_uid}/step/{step_uid}

URL Parameters:

NameDescriptionExample
workspaceWorkspace name /api/1.0/workflow/project/113406514573f91fdd453d7080353209/ activity/748962028577d84795d55b3012565154/ step/28191616657869600330ad8022614695
prj_uidUnique ID of the project (process), which can be obtained by examining the @@PROCESS system variable in the Debugger. /api/1.0/workflow/project/113406514573f91fdd453d7080353209/ activity/748962028577d84795d55b3012565154/ step/28191616657869600330ad8022614695
act_uidUnique ID of task, which can be obtained by examining the @@TASK system variable in the Debugger. /api/1.0/workflow/project/113406514573f91fdd453d7080353209/ activity/748962028577d84795d55b3012565154/ step/28191616657869600330ad8022614695
step_uidUnique ID of the step. /api/1.0/workflow/project/113406514573f91fdd453d7080353209/ activity/748962028577d84795d55b3012565154/ step/28191616657869600330ad8022614695

PUT Parameters:

ParameterDescription
{
"step_type_obj": "DYNAFORM", Optional. Type of step, which can be "DYNAFORM", "INPUT_DOCUMENT", "OUTPUT_DOCUMENT" or "EXTERNAL" (a step created by a plugin). Note that step_type_obj must be included if changing the step_uid_obj.
"step_uid_obj": "480515388526013e03f5323091406324",Optional. Unique ID of the step's object, which can be a Dynaform, Input Document, Output Document or External Step.
"step_mode": "EDIT", Optional. For classic processes imported or upgraded from ProcessMaker 2. The mode can be "EDIT" or "VIEW" for Dynaforms, "ATTACH" or "VIEW" for Input Documents, and "EDIT" for Output Documents. For BPMN processes, the mode is not used and should always be set to "EDIT".
"step_condition": "@@investigateClient == 'true'", Optional. A string containing a PHP condition, which can contain case and system variables. If it evaluates to true, then the step will be executed. If it evaluates to false, then it won't be executed. If the expression consists of a single value, remember that in PHP a non-zero number and a non-empty string are considered true.
"step_position": 1, Optional. The step position, where the first step in the task is 1, the second is 2, etc. If an object is already in that position, then it will be displaced downward in the step order. If not included, then the object will be placed as the last step in the task.
}

Result:

If successful, the HTTP status code is set to 200 (OK) and there is no return object. If an error occurs, the HTTP status code is 400 and an object like the following is returned:
{
  "error": {
    "code": 400,
    "message": "Bad Request: The Input Document with step_uid_obj: 969593549576b120e0c11b2046307156 does not exist."
  }
}

Example:

Request

Content-Type: application/json
{
  "step_type_obj":  "DYNAFORM",
  "step_uid_obj":   "761754168526157a5878337086391024",
  "step_condition": "",
  "step_position":  1,
  "step_mode":      "EDIT"
}

Response

200 (OK)

PHP Example:

Move a step to the beginning of a task and add a condition to the task:

$processId = '113406514573f91fdd453d7080353209';
$taskId =    '6537449955772ec4b9705a4019286874';
$stepId =    '761754168526157a5878337086391024';
$aParams = array (
   "step_position"  => 1,
   "step_condition" => "@@decision == 'redo' or @@decision == 'proceed'"
);
$url = "/api/1.0/workflow/project/$processId/activity/$taskId/step";
$oRet = pmRestRequest("POST", $url, $aParams);

if (isset($oRet->status) and $oRet->status == 200) {
   print "Step order changed.\n";
}

Unassign Step from Task: DELETE /project/{prj_uid}/activity/{act_uid}/step/{step_uid}

Unassigns a step from a task.

Permission:

Users must have the PM_FACTORY permission assigned to their role to perform this action.

Structure:

DELETE /api/1.0/{workspace}/project/{prj_uid}/activity/{act_uid}/step/{step_uid}

URL Parameters:

NameDescriptionExample
workspaceWorkspace name /api/1.0/workflow/project/113406514573f91fdd453d7080353209/ activity/748962028577d84795d55b3012565154/ step/28191616657869600330ad8022614695
prj_uidUnique ID of the project (process), which can be obtained by examining the @@PROCESS system variable in the Debugger. /api/1.0/workflow/project/113406514573f91fdd453d7080353209/ activity/748962028577d84795d55b3012565154/ step/28191616657869600330ad8022614695
act_uidUnique ID of task, which can be obtained by examining the @@TASK system variable in the Debugger. /api/1.0/workflow/project/113406514573f91fdd453d7080353209/ activity/748962028577d84795d55b3012565154/ step/28191616657869600330ad8022614695
step_uidUnique ID of the step. /api/1.0/workflow/project/113406514573f91fdd453d7080353209/ activity/748962028577d84795d55b3012565154/ step/28191616657869600330ad8022614695

Result:

If successful, then the HTTP status code is set to 200 (OK) and there is no return object. If an error occurs, the HTTP status code is set to 400 and an error object like the following is returned:
{
  "error": {
    "code":    400,
    "message": "Bad Request: The step with step_uid: 569912885578808e99e0091037758050 does not exist."
  }
}

Example:

Response

200 (OK)

PHP Example:

Assign a Dynaform as the last step in the task:

$processId = '113406514573f91fdd453d7080353209';
$taskId =    '6537449955772ec4b9705a4019286874';
$stepId =    '761754168526157a5878337086391024';

$url = "/api/1.0/workflow/project/$processId/activity/$taskId/step";
$oRet = pmRestRequest("DELETE", $url);

if (isset($oRet->status) and $oRet->status == 200) {
   print "Step unassigned from task.\n";
}

Get Triggers for Step: GET /project/{prj_uid}/activity/{act_uid}/step/{step_uid}/triggers

Gets the list of triggers assigned to be executed before and after a step.

GET /api/1.0/{workspace}/project/{prj_uid}/activity/{act_uid}/step/{step_uid}/triggers

URL Parameters:

NameDescriptionExample
workspaceWorkspace name /api/1.0/workflow/project/113406514573f91fdd453d7080353209/ activity/748962028577d84795d55b3012565154/step/ 28191616657869600330ad8022614695/triggers
prj_uidUnique ID of the project (process), which can be obtained by examining the @@PROCESS system variable in the Debugger. /api/1.0/workflow/project/113406514573f91fdd453d7080353209/ activity/748962028577d84795d55b3012565154/step/ 28191616657869600330ad8022614695/triggers
act_uidUnique ID of task, which can be obtained by examining the @@TASK system variable in the Debugger. /api/1.0/workflow/project/113406514573f91fdd453d7080353209/ activity/748962028577d84795d55b3012565154/step/ 28191616657869600330ad8022614695/triggers
step_uidUnique ID of the step. /api/1.0/workflow/project/113406514573f91fdd453d7080353209/ activity/748962028577d84795d55b3012565154/step/ 28191616657869600330ad8022614695/triggers

Result:

If successful, then the HTTP status code is set to 200 (OK) and an array of trigger objects is returned with the following structure:

ElementDescription
[ An array of trigger objects.
{ First trigger object.
"tri_uid": "389005986576b14b28bac58020591119",The unique ID of the trigger.
"tri_title": "Lookup criminal history", The title of the trigger.
"tri_description":"Database searches on client", The description of the trigger.
"st_type": "BEFORE", The type of execution, which is "BEFORE" if executed before the step or "AFTER" if executed after the step.
"st_condition": "@@criminalHistory == 'yes'", A string containing the trigger's condition. If it evaluates to true, then the trigger will be executed.
"st_position": 1 The trigger's position, which is 1 for the first trigger, 2 for the second trigger, etc. There is separate counting for "BEFORE" and "AFTER" triggers.
}, End first trigger object.
... Any additional trigger objects.
] End array of trigger objects.

Example:

Response

200 (OK)
Content-Type: application/json
[
  {
    "tri_uid":         "19856489857895a61303773072293247",
    "tri_title":       "Abort case if existing investigation",
    "tri_description": "",
    "st_type":         "BEFORE",
    "st_condition":    "@@pendingInvestigation == 'yes'",
    "st_position":     1
  },
  {
    "tri_uid":         "57585726657895a339dee40040903466",
    "tri_title":       "Get process information",
    "tri_description": "",
    "st_type":         "BEFORE",
    "st_condition":    ""
    "st_position":     2
  },
  {
    "tri_uid":         "604830947578697355a2fc5053242432",
    "tri_title":       "Get User Info",
    "tri_description": "Get user's first and last names",
    "st_type":         "AFTER",
    "st_condition":    "",
    "st_position":     1
  },
  {
    "tri_uid":         "389005986576b14b28bac58020591119",
    "tri_title":       "show history"
    "tri_description": "",
    "st_type":         "AFTER",
    "st_condition":    "",
    "st_position":     2
  }
]

PHP Example:

Check whether a trigger titled "Get process information" is assigned to the task:

$triggerTitle = "Get process information";
$processId = '113406514573f91fdd453d7080353209';
$taskId = '294620094573f92543c7d99010162468';
$stepId = '416553979576b12e1d6a4f7063384631';

$url = "/api/1.0/workflow/project/$processId/activity/$taskId/step/$stepId/triggers";
$oRet = pmRestRequest("GET", $url);

if (isset($oRet->status) and $oRet->status == 200) {
   $TriggerFount = false;
   //search for the ID of the trigger:
   foreach ($oRet->response as $oTrigger) {
      if ($oTrigger->tri_title == $triggerTitle) {
         $triggerFound = true;
      }
   }
}

Get Available Triggers for Step: GET /project/{prj_uid}/activity/{act_uid}/step/{step_uid}/available-triggers/{type}

Gets the list of available triggers to assign to a step.

GET /api/1.0/{workspace}/project/{prj_uid}/activity/{act_uid}/step/{step_uid}/available-triggers/{type}

URL Parameters:

NameDescriptionExample
workspaceWorkspace name /api/1.0/workflow/project/113406514573f91fdd453d7080353209/ activity/748962028577d84795d55b3012565154/step/ 28191616657869600330ad8022614695/available-triggers/before
prj_uidUnique ID of the project (process), which can be obtained by examining the @@PROCESS system variable in the Debugger. /api/1.0/workflow/project/113406514573f91fdd453d7080353209/ activity/748962028577d84795d55b3012565154/step/ 28191616657869600330ad8022614695/available-triggers/before
act_uidUnique ID of the task, which can be obtained by examining the @@TASK system variable in the Debugger./api/1.0/workflow/project/113406514573f91fdd453d7080353209/ activity/748962028577d84795d55b3012565154/step/ 28191616657869600330ad8022614695/available-triggers/before
step_uidUnique ID of the step./api/1.0/workflow/project/113406514573f91fdd453d7080353209/ activity/748962028577d84795d55b3012565154/step/ 28191616657869600330ad8022614695/available-triggers/before
typeWhen the trigger is executed, which can be either "before" or "after" the step. /api/1.0/workflow/project/113406514573f91fdd453d7080353209/ activity/748962028577d84795d55b3012565154/step/ 28191616657869600330ad8022614695/available-triggers/before

Result:

ElementDescription
[Start array of trigger objects.
{First trigger object.
"tri_uid": "550289117529f8ba2705074055790637",Unique ID of the trigger.
"tri_title": "Get user's email",Title of the trigger.
"tri_description": "",Description of the trigger.
"tri_type": "SCRIPT",The type is always "SCRIPT".
"tri_webbot": "@@email = userInfo(@@USER_LOGGED)['mail'];",PHP code of the trigger.
"tri_param": ""A serialized array of parameters for the trigger's function if it was created with the trigger wizard. If a custom trigger, then set to "" (an empty string).
},End first trigger object.
...Any additional trigger objects.
]End array.

Example:

Response

200 (OK)
Content-Type: application/json
[
  {
    "tri_uid":         "550289117529f8ba2705074055790637",
    "tri_title":       "Get user's email",
    "tri_description": "",
    "tri_type":        "SCRIPT",
    "tri_webbot":      "@@email = userInfo(@@USER_LOGGED)['mail'];",
    "tri_param":       ""
  },
  {
    "tri_uid":         "451169569578965bd2a5513008268885",
    "tri_title":       "Email Manager",
    "tri_description": "Send email to the user's supervisor about the delayed case",
    "tri_type":        "SCRIPT",
    "tri_webbot":      "/*******************************************************\n *\n * Generated by ProcessMaker Trigger Wizard\n * Library: ProcessMaker Functions\n * Method: PMF Send Message\n* Date: 2016-07-15 18:37:49\n *\n * ProcessMaker 2016\n ********************************************************/\n\n@@msgReturn = PMFSendMessage(@@APPLICATION, @@userEmail, @@supervisorEmail, "", "", "Delayed case #" . @@APP_NUMBER, "\"lateCaseInfo.html\"", array(''), array(''), true, 0, "");",
    "
tri_param": "a:2:{s:4:"hash";s:32:"59ee25a760bc8544589dd33834faa352";s:6:"params";a:29:{s:7:"TRI_UID";s:32:"451169569578965bd2a5513008268885";s:9:"TRI_TITLE";s:13:"Email Manager";s:15:"TRI_DESCRIPTION";s:58:"Send email to the user's supervisor about the delayed case";s:8:"TRI_TYPE";s:6:"SCRIPT";s:7:"PRO_UID";s:32:"113406514573f91fdd453d7080353209";s:6:"caseId";s:13:"@@APPLICATION";s:5:"sFrom";s:11:"@@userEmail";s:3:"sTo";s:17:"@@supervisorEmail";s:3:"sCc";s:0:"";s:4:"sBcc";s:0:"";s:8:"sSubject";s:31:""Delayed case #" . @@APP_NUMBER";s:9:"sTemplate";s:19:""lateCaseInfo.html"";s:7:"aFields";s:9:"array('')";s:11:"aAttachment";s:9:"array('')";s:11:"showMessage";s:0:"";s:8:"delIndex";s:0:"";s:6:"config";s:0:"";s:10:"TRI_ANSWER";s:11:"@@msgReturn";s:10:"TRI_WEBBOT";s:459:"/*******************************************************\n *\n * Generated by ProcessMaker Trigger Wizard\n * Library: ProcessMaker Functions\n * Method: PMF Send Message\n * Date: 2016-07-15 18:37:49\n *\n * ProcessMaker 2016\n *\n *******************************************************/\n\n@@msgReturn = PMFSendMessage(@@APPLICATION, @@userEmail, @@supervisorEmail, "", "", "Delayed case #" . @@APP_NUMBER, "\"lateCaseInfo.html\"", array(''), array(''), true, 0, "");";s:25:"__notValidateThisFields__";s:0:"";s:22:"DynaformRequiredFields";s:2:"[]";s:14:"PAGED_TABLE_ID";s:0:"";s:12:"LIBRARY_NAME";s:22:"ProcessMaker Functions";s:13:"LIBRARY_CLASS";s:21:"class.pmFunctions.php";s:14:"PMFUNTION_NAME";s:14:"PMFSendMessage";s:15:"PMFUNTION_LABEL";s:16:"PMF Send Message";s:11:"ALLFUNCTION";s:104:"$caseId,$sFrom,$sTo,$sCc,$sBcc,$sSubject,$sTemplate,$aFields,$aAttachment,$showMessage,$delIndex,$config";s:16:"ALLFUNCTION_TYPE";s:79:"string,string,string,string,string,string,string,array,array,boolean,int,string";s:15:"FIELDS_REQUIRED";s:46:"caseId,sFrom,sTo,sSubject,sTemplate,TRI_ANSWER";}}"
  }
]

PHP example:

This example retrieves the list of available triggers for a step, and then searches for the one whose title is "Email Manager" and assigns it to execute before the step.

$processId = '113406514573f91fdd453d7080353209';
$taskId    = '294620094573f92543c7d99010162468';
$stepId    = '416553979576b12e1d6a4f7063384631';
$url = "/api/1.0/workflow/project/$processId/activity/$taskId/step/$stepId/available-triggers/before";

$oRet = pmRestRequest("GET", $url, $aParams, $oToken->access_token);

if (isset($oRet->status) and $oRet->status == 200) {
   //search for the trigger named "Email Manager" and assign it to the task.
   $triggerId = '';
   foreach ($oRet->response as $aTrigger) {
      if ($aTrigger->tri_title == "Email Manager") {
         $triggerId = $aTrigger->tri_uid;
         break;
      }
   }

   if ($triggerId) {
      $url = "/api/1.0/workflow/project/$processId/activity/$taskId/step/$stepId/trigger";
      $aParams = array(
        "tri_uid"      => $triggerId,
         "st_type"      => "BEFORE",
         "st_condition" => "",
         "st_position"  => 1
     );
      $oRet = pmRestRequest("POST", $url, $aParams, $oToken->access_token);
   }
}

Get Trigger for Step: GET /project/{prj_uid}/activity/{act_uid}/step/{step_uid}/trigger/{tri_uid}/{type}

Gets information about a single trigger assigned to a step.

GET /api/1.0/{workspace}/project/{prj_uid}/activity/{act_uid}/step/{step_uid}/trigger/{tri_uid}/{type}

URL Parameters:

NameDescriptionExample
workspaceWorkspace name /api/1.0/workflow/project/113406514573f91fdd453d7080353209/ activity/748962028577d84795d55b3012565154/step/ 28191616657869600330ad8022614695/trigger/451169569578965bd2a5513008268885/before
prj_uidUnique ID of the project (process), which can be obtained by examining the @@PROCESS system variable in the Debugger. /api/1.0/workflow/project/113406514573f91fdd453d7080353209/ activity/748962028577d84795d55b3012565154/step/ 28191616657869600330ad8022614695/trigger/ 451169569578965bd2a5513008268885/before
act_uidUnique ID of the task, which can be obtained by examining the @@TASK system variable in the Debugger. /api/1.0/workflow/project/113406514573f91fdd453d7080353209/ activity/748962028577d84795d55b3012565154/step/ 28191616657869600330ad8022614695/trigger/ 451169569578965bd2a5513008268885/before
step_uidUnique ID of the step. /api/1.0/workflow/project/113406514573f91fdd453d7080353209/ activity/748962028577d84795d55b3012565154/step/ 28191616657869600330ad8022614695/trigger/ 451169569578965bd2a5513008268885/before
tri_uidUnique ID of the trigger. /api/1.0/workflow/project/113406514573f91fdd453d7080353209/ activity/748962028577d84795d55b3012565154/ step/28191616657869600330ad8022614695/trigger/ 451169569578965bd2a5513008268885/before
typeWhen the trigger is executed, which can be either before or after the step. /api/1.0/workflow/project/113406514573f91fdd453d7080353209/ activity/748962028577d84795d55b3012565154/ step/28191616657869600330ad8022614695/trigger/ 451169569578965bd2a5513008268885/before

Result:

ElementDescription
{Start trigger object
"tri_uid": "550289117529f8ba2705074055790637",Unique ID of the trigger.
"tri_title": "Get user's email",Title of the trigger.
"tri_description": "",Description of the trigger.
"st_type": "BEFORE",Indicates whether the trigger is executed "BEFORE" or "AFTER" the step.
"st_condition": "@#amount > 500",A condition in PHP language that can contain case variables. If it evaluates to true, then the trigger will be executed; otherwise, it won't be executed if it evaluates to false.
"st_position": 2The execution order of the trigger, where the first trigger to execute is 1, the second is 2, etc. There is separate counting for "BEFORE" and "AFTER" triggers.
}End trigger object.

Example:

Response

200 (OK)
Content-Type: application/json
{
  "tri_uid":         "287964159526013c6c64bb1071946215",
  "tri_title":       "Notify Clients",
  "tri_description": "Send email to all clients with contracts",
  "st_type":         "BEFORE",
  "st_condition":    "",
  "st_position":     1
}

PHP example:

$processId = '113406514573f91fdd453d7080353209';
$taskId    = '294620094573f92543c7d99010162468';
$stepId    = '416553979576b12e1d6a4f7063384631';
$triggerId = '451169569578965bd2a5513008268885';
$type      = 'before';
$url = "/api/1.0/workflow/project/$processId/activity/$taskId/step/$stepId/trigger/$triggerId/$type";

$oRet = pmRestRequest("GET", $url);

if (isset($oRet->status) and $oRet->status == 200) {
   $position = $oRet->response->st_position;
}

Assign Trigger to Step: POST /project/{prj_uid}/activity/{act_uid}/step/{step_uid}/trigger

Assigns a trigger to a step.

Permission:

Users must have the PM_FACTORY permission assigned to their role to perform this action.

Structure:

POST /api/1.0/{workspace}/project/{prj_uid}/activity/{act_uid}/step/{step_uid}/trigger

URL parameters:

NameDescriptionExample
workspaceWorkspace name /api/1.0/workflow/project/113406514573f91fdd453d7080353209/ activity/748962028577d84795d55b3012565154/step/ 28191616657869600330ad8022614695/trigger
prj_uidUnique ID of the project (process), which can be obtained by examining the @@PROCESS system variable in the Debugger. /api/1.0/workflow/project/113406514573f91fdd453d7080353209/ activity/748962028577d84795d55b3012565154/step/ 28191616657869600330ad8022614695/trigger
act_uidUnique ID of the task, which can be obtained by examining the @@TASK system variable in the Debugger. /api/1.0/workflow/project/113406514573f91fdd453d7080353209/ activity/748962028577d84795d55b3012565154/step/ 28191616657869600330ad8022614695/trigger
step_uidUnique ID of the step. /api/1.0/workflow/project/113406514573f91fdd453d7080353209/ activity/748962028577d84795d55b3012565154/step/ 28191616657869600330ad8022614695/trigger

POST fields:

ElementDescription
{Start trigger object
"tri_uid": "550289117529f8ba2705074055790637",Unique ID of the trigger.
"st_type": "BEFORE",Indicates whether the trigger is executed "BEFORE" or "AFTER" the step.
"st_condition": "@#amount > 500",(Optional) A condition in PHP language that can contain case variables. If it evaluates to true, then the trigger will be executed; otherwise, it won't be executed if it evaluates to false.
"st_position": 2The execution order of the trigger, where the first trigger to execute is 1, the second is 2, etc. There is separate counting for "BEFORE" and "AFTER" triggers. If a trigger is already occupying that position, it will be displaced downward in the list.
}End trigger object.

Result:

If successful, then the HTTP status is set to 201 (created) and there is no return object.

Example:

Request

Content-Type: application/json
{
    "tri_uid":      "502389187526013d4304108061369115",
    "st_type":      "BEFORE",
    "st_condition": "@@APPROVED == 'Y'",
    "st_position":  2
}

Response

201 (Created)

PHP example:

$processId = '113406514573f91fdd453d7080353209';
$taskId    = '294620094573f92543c7d99010162468';
$stepId    = '416553979576b12e1d6a4f7063384631';
$url = "/api/1.0/workflow/project/$processId/activity/$taskId/step/$stepId/trigger";
$aParams = array(
    "tri_uid"      => '451169569578965bd2a5513008268885',
    "st_type"      => 'AFTER',
    "st_position"  => 1
);
$oRet = pmRestRequest("POST", $url, $aParams, $oToken->access_token);

if ($oRet->status != 201) {
   print "Problem setting trigger in step";
}

Update Trigger Assignment: PUT /project/{prj_uid}/activity/{act_uid}/step/{step_uid}/trigger/{tri_uid}

Updates the assignment of a trigger to a step.

Permission:

Users must have the PM_FACTORY permission assigned to their role to perform this action.

Structure:

PUT /api/1.0/{workspace}/project/{prj_uid}/activity/{act_uid}/step/{step_uid}/trigger/{tri_uid}

URL parameters:

NameDescriptionExample
workspaceWorkspace name /api/1.0/workflow/project/113406514573f91fdd453d7080353209/ activity/748962028577d84795d55b3012565154/step/ 28191616657869600330ad8022614695/trigger/550289117529f8ba2705074055790637
prj_uidUnique ID of the project (process), which can be obtained by examining the @@PROCESS system variable in the Debugger. /api/1.0/workflow/project/113406514573f91fdd453d7080353209/ activity/748962028577d84795d55b3012565154/step/ 28191616657869600330ad8022614695/trigger/550289117529f8ba2705074055790637
act_uidUnique ID of the task, which can be obtained by examining the @@TASK system variable in the Debugger. /api/1.0/workflow/project/113406514573f91fdd453d7080353209/ activity/748962028577d84795d55b3012565154/step/ 28191616657869600330ad8022614695/trigger/550289117529f8ba2705074055790637
step_uidUnique ID of the step. /api/1.0/workflow/project/113406514573f91fdd453d7080353209/ activity/748962028577d84795d55b3012565154/step/ 28191616657869600330ad8022614695/trigger/550289117529f8ba2705074055790637
tri_uidUnique ID of the trigger. /api/1.0/workflow/project/113406514573f91fdd453d7080353209/ activity/748962028577d84795d55b3012565154/step/ 28191616657869600330ad8022614695/trigger/550289117529f8ba2705074055790637

PUT fields:

ElementDescription
{Start trigger object
"st_type": "BEFORE",Required. Indicates whether the trigger is executed "BEFORE" or "AFTER" the step. Note that it is NOT possible to change the st_type with this endpoint. If needing to change the st_type, first unassign the trigger from the step and then reassign it.
"st_condition": "@#amount > 500",Optional. A condition in PHP language that can contain case variables. If it evaluates to true, then the trigger will be executed; otherwise, it won't be executed if it evaluates to false.
"st_position": 2Optional. The execution order of the trigger, where the first trigger to execute is 1, the second is 2, etc. There is separate counting for "BEFORE" and "AFTER" triggers. If a trigger is already occupying that position, it will be displaced downward in the list.
}End trigger object.

Result:

If successful, then the HTTP status is set to 200 (OK) and there is no return object. If an error occurs, then an error object like the following is returned:

{
    "error": {
        "code":    400,
        "message": "Bad Request: The row '416553979576b12e1d6a4f7063384631, 294620094573f92543c7d99010162468, 451169569578965bd2a5513008268885, AFTER' in table StepTrigger doesn't exist!"
    }
}

Example:

Request

Content-Type: application/json
{
    "st_type":      "BEFORE",
    "st_condition": "@@APPROVED == 'XY'",
    "st_position":  2
}

Response

200 (OK)

PHP example:

$processId = '113406514573f91fdd453d7080353209';
$taskId    = '294620094573f92543c7d99010162468';
$stepId    = '416553979576b12e1d6a4f7063384631';
$url = "/api/1.0/workflow/project/$processId/activity/$taskId/step/$stepId/trigger/451169569578965bd2a5513008268885";
$aParams = array(
    "st_type"      => 'AFTER',
    "st_condition" => "@@APPROVED == 'XY'",
    "st_position"  => 1
);
$oRet = pmRestRequest("PUT", $url, $aParams, $oToken->access_token);

if ($oRet->status != 201) {
   print "Problem resetting trigger in step";
}

Unassign Trigger from Step:
DELETE /project/{prj_uid}/activity/{act_uid}/step/{step_uid}/trigger/{tri_uid}/{type}

Unassigns a trigger from a step.

Permission:

Users must have the PM_FACTORY permission assigned to their role to perform this action.

Structure:

DELETE /api/1.0/{workspace}/project/{prj_uid}/activity/{act_uid}/step/{step_uid}/trigger/{tri_uid}/{type}

URL parameters:

NameDescriptionExample
workspaceWorkspace name /api/1.0/workflow/project/113406514573f91fdd453d7080353209/ activity/748962028577d84795d55b3012565154/step/ 28191616657869600330ad8022614695/trigger/550289117529f8ba2705074055790637/ before
prj_uidUnique ID of the project (process), which can be obtained by examining the @@PROCESS system variable in the Debugger. /api/1.0/workflow/project/113406514573f91fdd453d7080353209/ activity/748962028577d84795d55b3012565154/step/ 28191616657869600330ad8022614695/trigger/550289117529f8ba2705074055790637/ before
act_uidUnique ID of the task, which can be obtained by examining the @@TASK system variable in the Debugger. /api/1.0/workflow/project/113406514573f91fdd453d7080353209/ activity/748962028577d84795d55b3012565154/step/ 28191616657869600330ad8022614695/trigger/550289117529f8ba2705074055790637/ before
step_uidUnique ID of the step. /api/1.0/workflow/project/113406514573f91fdd453d7080353209/ activity/748962028577d84795d55b3012565154/step/ 28191616657869600330ad8022614695/trigger/550289117529f8ba2705074055790637/ before
tri_uidUnique ID of the trigger. /api/1.0/workflow/project/113406514573f91fdd453d7080353209/ activity/748962028577d84795d55b3012565154/step/ 28191616657869600330ad8022614695/trigger/550289117529f8ba2705074055790637 /before
typeSet to before or after to indicate whether the trigger is executed before or after the step. /api/1.0/workflow/project/113406514573f91fdd453d7080353209/ activity/748962028577d84795d55b3012565154/step/ 28191616657869600330ad8022614695/trigger/550289117529f8ba2705074055790637/ before

Result:

Set to 200 (OK) if the trigger is unassigned from the step, so it will not be executed.

Example:

Response

200 (OK)

PHP example:

$processId = '113406514573f91fdd453d7080353209';
$taskId    = '294620094573f92543c7d99010162468';
$stepId    = '416553979576b12e1d6a4f7063384631';
$triggerId = '451169569578965bd2a5513008268885';
$type      = 'before';
$url = "/api/1.0/workflow/project/$processId/activity/$taskId/step/$stepId/trigger/$triggerId/$type";

$oRet = pmRestRequest("DELETE", $url);

if ($oRet->status == 400) {
   print "Error removing trigger from step: " . $oRet->error->message;
}


Step endpoints - Assign Task (a special step that has no UID)

Get Triggers for Task: GET /project/{prj_uid}/activity/{act_uid}/step/triggers

Gets the list of assigned triggers in a task.

GET /api/1.0/{workspace}/project/{prj_uid}/activity/{act_uid}/step/triggers

URL Parameters:

NameDescriptionExample
workspaceWorkspace name /api/1.0/workflow/project/113406514573f91fdd453d7080353209/ activity/748962028577d84795d55b3012565154/step/triggers
prj_uidUnique ID of the project (process), which can be obtained by examining the @@PROCESS system variable in the Debugger. /api/1.0/workflow/project/113406514573f91fdd453d7080353209/ activity/748962028577d84795d55b3012565154/step/triggers
act_uidUnique ID of the task, which can be obtained by examining the @@TASK system variable in the Debugger. /api/1.0/workflow/project/113406514573f91fdd453d7080353209/ activity/748962028577d84795d55b3012565154/step/triggers

Result:

TypeDescription
arrayReturns an object array with data about each trigger.

Example:

Response

200 (OK)
Content-Type: application/json
[
  {
    "tri_uid":         "287964159526013c6c64bb1071946215",
    "tri_title":       "tgr1",
    "tri_description": "tgr1 DESCRIPTION",
    "st_type":         "BEFORE_ASSIGNMENT",
    "st_condition":    "",
    "st_position":     1
  },
  {
    "tri_uid":         "287964159526013c6c64bb1071946215",
    "tri_title":       "tgr1",
    "tri_description": "tgr1 DESCRIPTION",
    "st_type":         "BEFORE_ROUTING",
    "st_condition":    "",
    "st_position":     1
  },
  {
    "tri_uid":         "287964159526013c6c64bb1071946215",
    "tri_title":       "tgr1",
    "tri_description": "tgr1 DESCRIPTION",
    "st_type":         "AFTER_ROUTING",
    "st_condition":    "",
    "st_position":     1
  }
]

Available Triggers for Activity: GET /project/{prj_uid}/activity/{act_uid}/step/available-triggers/{type}

Gets the list of available triggers to assign.

GET /api/1.0/{workspace}/project/{prj_uid}/activity/{act_uid}/step/available-triggers/{type}

Parameters:

NameTypeDescription
workspaceStringWorkspace name
prj_uidStringProject UID
act_uidStringActivity UID
typeStringTrigger Type

Result:

TypeDescription
arrayReturns an object array with data about each trigger available for the step (according to the execution type)

Example:

Response

 200 (OK)
 Content-Type: application/json
 [
    {
        "tri_uid": "550289117529f8ba2705074055790637",
        "tri_title": "tgr5",
        "tri_description": "tgr5 DESCRIPTION",
        "tri_type": "SCRIPT",
        "tri_webbot": "",
        "tri_param": ""
    },
    {
        "tri_uid": "741936587529f8bb997e9d2054874954",
        "tri_title": "tgr6",
        "tri_description": "tgr6 DESCRIPTION",
        "tri_type": "SCRIPT",
        "tri_webbot": "",
        "tri_param": ""
    }
 ]

Get Trigger for Activity: GET /project/{prj_uid}/activity/{act_uid}/step/trigger/{tri_uid}/{type}

Gets a single trigger assigned to a step in an activity.

GET /api/1.0/{workspace}/project/{prj_uid}/activity/{act_uid}/step/trigger/{tri_uid}/{type}

Parameters:

NameTypeDescription
workspaceStringWorkspace name
prj_uidStringProject UID
act_uidStringActivity UID
tri_uidStringTrigger UID
typeStringType of trigger execution (before-assignment, before-routing, after-routing)

Result:

TypeDescription
objectReturns an object with data about the trigger.

Example:

Response

 200 (OK)
 Content-Type: application/json
 {
    "tri_uid": "287964159526013c6c64bb1071946215",
    "tri_title": "tgr1",
    "tri_description": "tgr1 DESCRIPTION",
    "st_type": "BEFORE_ASSIGNMENT",
    "st_condition": "",
    "st_position": 1
 }

Assign a Trigger to Activity: POST /project/{prj_uid}/activity/{act_uid}/step/trigger

Assigns a trigger to the "Assignment" or "Routing" step section of an activity.

Permission:

Users must have the PM_FACTORY permission assigned to their role to perform this action.

Structure:

POST /api/1.0/{workspace}/project/{prj_uid}/activity/{act_uid}/step/trigger

Parameters:

NameTypeDescription
workspaceStringWorkspace name
prj_uidStringProject UID
act_uidStringActivity UID

POST fields:

Element Description
{Start trigger object
"tri_uid": "550289117529f8ba2705074055790637",Unique ID of the trigger.
"st_type": "BEFORE_ROUTING",Indicates whether the trigger is executed "BEFORE_ASSIGNMENT", "BEFORE_ROUTING" or "AFTER_ROUTING" the case.
"st_condition": "@#amount > 500",(Optional) A condition in PHP language that can contain case variables. If it evaluates to true, then the trigger will be executed; otherwise, it won't be executed if it evaluates to false.
"st_position": 2The execution order of the trigger, where the first trigger to execute is 1, the second is 2, etc. There is separate counting for "BEFORE" and "AFTER" triggers. If a trigger is already occupying that position, it will be displaced downward in the list.
}End trigger object.

Result:

Type Description
emptyNo return

Example:

Request

 Content-Type: application/json
{
    "tri_uid": "6120910645852c920eba7d9069690137",
    "st_type": "BEFORE_ASSIGNMENT",
    "st_condition": "@@APPROVED == 'Y'",
    "st_position": 1
}

Response

 201 (Created)

Update Trigger: PUT /project/{prj_uid}/activity/{act_uid}/step/trigger/{tri_uid}

Updates a trigger that was assigned to the "Assignment" or "Routing" step section of an activity.

Permission:

Users must have the PM_FACTORY permission assigned to their role to perform this action.

Structure:

PUT /api/1.0/{workspace}/project/{prj_uid}/activity/{act_uid}/step/trigger/{tri_uid}

Parameters:

NameTypeDescription
workspaceStringWorkspace name
prj_uidStringProject UID
act_uidStringActivity UID
tri_uidStringTrigger UID

PUT fields:

ElementDescription
{Start trigger object
"st_type": "BEFORE_ASSIGNMENT",Required. Indicates whether the trigger is executed "BEFORE_ASSIGNMENT", "BEFORE_ROUTING", "AFTER_ROUTING" the task. Note that it is NOT possible to change the st_type with this endpoint. If needing to change the st_type, first unassign the trigger from the task and then reassign it.
"st_condition": "@#amount > 500",Optional. A condition in PHP language that can contain case variables. If it evaluates to true, then the trigger will be executed; otherwise, it won't be executed if it evaluates to false.
"st_position": 2Optional. The execution order of the trigger, where the first trigger to execute is 1, the second is 2, etc. There is separate counting for "BEFORE" and "AFTER" triggers. If a trigger is already occupying that position, it will be displaced downward in the list.
}End trigger object.

Result:

TypeDescription
emptyNo return

Example:

Request

 Content-Type: application/json
{
    "st_type": "BEFORE_ASSIGNMENT",
    "st_condition": "@@APPROVED == 'N'",
    "st_position": 2
}

Response

 200 (OK)

Unassign Trigger: DELETE /project/{prj_uid}/activity/{act_uid}/step/trigger/{tri_uid}/{type}

Unassigns a trigger from the "Assignment" or "Routing" step section of an activity.

Permission:

Users must have the PM_FACTORY permission assigned to their role to perform this action.

Structure:

DELETE: /api/1.0/{workspace}/project/{prj_uid}/activity/{act_uid}/step/trigger/{tri_uid}/{type}

URL parameters:

NameDescriptionExample
workspaceWorkspace name/api/1.0/workflow/project/113406514573f91fdd453d7080353209/ activity/748962028577d84795d55b3012565154/step/ trigger/6120910645852c920eba7d9069690137/before-routing
prj_uidUnique ID of the project (process), which can be obtained by examining the @@PROCESS system variable in the Debugger. /api/1.0/workflow/project/113406514573f91fdd453d7080353209/ activity/748962028577d84795d55b3012565154/step/ trigger/6120910645852c920eba7d9069690137/before-routing
act_uidUnique ID of the task, which can be obtained by examining the @@TASK system variable in the Debugger. /api/1.0/workflow/project/113406514573f91fdd453d7080353209/ activity/748962028577d84795d55b3012565154/step/ trigger/6120910645852c920eba7d9069690137/before-routing
tri_uidUnique ID of the trigger./api/1.0/workflow/project/113406514573f91fdd453d7080353209/ activity/748962028577d84795d55b3012565154/step/ trigger/6120910645852c920eba7d9069690137/before-routing
typeSet to before-assignment, before-routing or after-routing to indicate whether the trigger is executed in the task./api/1.0/workflow/project/113406514573f91fdd453d7080353209/ activity/748962028577d84795d55b3012565154/step/ trigger/6120910645852c920eba7d9069690137/before-routing

Result:

TypeDescription
emptyNo return

Example:

Response

 200 (OK)