Difference between revisions of "REST API:Workflow Resources"

From LongJump Support Wiki
imported>Aeric
 
imported>Aeric
m (Text replace - '<tt><nowiki>https://{domain}/networking' to '<tt>{{platformURL}}')
Line 13: Line 13:
;Method:GET
;Method:GET
   
   
;URI:<tt><nowiki>https://{domain}/networking/rest/record/{objectName}/{recordId}/workflowOwners</nowiki></tt>
;URI:<tt>{{platformURL}}/rest/record/{objectName}/{recordId}/workflowOwners</nowiki></tt>


;Response:
;Response:
Line 53: Line 53:


;Method:GET
;Method:GET
;URI:<tt><nowiki>https://{domain}/networking/rest/workflowAction/record/{objectName}/{recordId}</nowiki></tt>
;URI:<tt>{{platformURL}}/rest/workflowAction/record/{objectName}/{recordId}</nowiki></tt>


;Response:
;Response:
Line 290: Line 290:


;Method:POST
;Method:POST
;URI:<tt><nowiki>https://{domain}/networking/rest/record/{objectName}/{recordId}/operation/changeWorkflowState</nowiki></tt>
;URI:<tt>{{platformURL}}/rest/record/{objectName}/{recordId}/operation/changeWorkflowState</nowiki></tt>


;Request:
;Request:

Revision as of 20:55, 30 March 2012

Manage Workflow record states using the REST API.

Notepad.png

Note: This resource is available for Custom Objects. It is not available for Built-in or CRM objects.

Learn more: Workflow Records, States, Actions, and Owners

Permissions

Lock-tiny.gif

Users that have the Customize Objects permission can use Workflow APIs 

Identify Workflow Owners

Identify current owner(s) of a record in a workflow.

Method
GET
URI
https://na.longjump.com/networking/rest/record/{objectName}/{recordId}/workflowOwners</nowiki>
Response
<platform>
    <record>
        <availableWFOwners>
            <owners>
                <id>123qwe456rty</id>
                <fullname>John Smith</fullname>
            </owners>
            <owners>
                <id>456rty789uio</id>
                <fullname>Jane Doe</fullname>
            </owners>
        </availableWFOwners>
    </record>

    <message>
        <code>0</code>
        <description>Success</description>
    </message>
</platform>
See also: REST API:Error Codes

List Available Actions

Retrieve the actions available for a record, depending on its current Workflow state.

Considerations
  • Eligible actions are those that meet the action criteria, where the user has appropriate permissions take the action.
  • The action list is generated according to the following rules:
  • Eligible actions (which fit the criteria) are returned with the "available" field being set to "1"
  • Non-eligible actions are returned with "available" set as "0".
  • If multiple actions exist with the same name, then only the eligible action is returned, with "available" = 1
  • If multiple eligible actions exist with the same name, then all of the actions are returned with "available" = 1
  • If multiple non-eligible actions exist with the same name, then all of the are returned with "available" = 0
Method
GET
URI
https://na.longjump.com/networking/rest/workflowAction/record/{objectName}/{recordId}</nowiki>
Response
<?xml version="1.0" encoding="UTF-8" standalone="yes"?>
 <platform>
    <workflowAction>
        <date_created>2010-11-12T13:14:15Z</date_created>
        <date_modified>2010-11-12T13:14:15Z</date_modified>
        <created_id type=""
	    uri="https://{domain}/networking/rest/user/b2912a93cb0e" 
	    displayValue="Smith;;Mary">b2912a93cb0e</created_id>
        <modified_id type="" 
	    uri="https://{domain}/networking/rest/user/b2912a93cb0e" 
	    displayValue="Smith;;Mary">b2912a93cb0e</modified_id>
        <object_id>2b934310dbd24347813a722ab8724eb3</object_id>
        <record_id>1381445705</record_id>
        <id>e5c9c2deaaf240c2b45d54b0cea320aa</id>
        <name>action1</name>
        <title>action1</title>
        <currentStateId>38c8725a13e04ec08796f1b0791da071</currentStateId>
        <nextStateId>0a324a8eea444adc861f8a0d42f384bd</nextStateId>
        <notifyRecordOwner>0</notifyRecordOwner>
        <additionalUserToNotify type="" 
	    uri="https://{domain}/networking/rest/user/123456789" 
	    displayValue="User1 Name">123456789</additionalUserToNotify>
        <additionalUserToNotify type="" 
	    uri="https://{domain}/networking/rest/user/223456789" 
	    displayValue="User2 Name">223456789</additionalUserToNotify>
        <customCriteria></customCriteria>
        <actionCriteria>
            <criteria_1_join_operator></criteria_1_join_operator>
            <criteria_1_pre_bracket></criteria_1_pre_bracket>
            <criteria_1_post_bracket></criteria_1_post_bracket>
            <criteria_1_column>amount</criteria_1_column>
            <criteria_1_operator>lteq</criteria_1_operator>
            <criteria_1_value>100</criteria_1_value>
            <criteria_2_join_operator></criteria_2_join_operator>
            <criteria_2_pre_bracket></criteria_2_pre_bracket>
            <criteria_2_post_bracket></criteria_2_post_bracket>
            <criteria_2_column></criteria_2_column>
            <criteria_2_operator></criteria_2_operator>
            <criteria_2_value></criteria_2_value>
            <criteria_3_join_operator></criteria_3_join_operator>
            <criteria_3_pre_bracket></criteria_3_pre_bracket>
            <criteria_3_post_bracket></criteria_3_post_bracket>
            <criteria_3_column></criteria_3_column>
            <criteria_3_operator></criteria_3_operator>
            <criteria_3_value></criteria_3_value>
            <criteria_4_join_operator></criteria_4_join_operator>
            <criteria_4_pre_bracket></criteria_4_pre_bracket>
            <criteria_4_post_bracket></criteria_4_post_bracket>
            <criteria_4_column></criteria_4_column>
            <criteria_4_operator></criteria_4_operator>
            <criteria_4_value></criteria_4_value>
            <criteria_5_join_operator></criteria_5_join_operator>
            <criteria_5_pre_bracket></criteria_5_pre_bracket>
            <criteria_5_post_bracket></criteria_5_post_bracket>
            <criteria_5_column></criteria_5_column>
            <criteria_5_operator></criteria_5_operator>
            <criteria_5_value></criteria_5_value>
        </actionCriteria>
        <available>0</available>
    </workflowAction>
    <workflowAction>
        <date_created>2010-11-12T13:14:15Z</date_created>
        <date_modified>2010-11-12T13:14:15Z</date_modified>
        <created_id type="" 
	    uri="https://{domain}/networking/rest/user/b2912a93cb0e" 
	    displayValue="Smith;;Mary">b2912a93cb0e</created_id>
        <modified_id type="" 
	    uri="https://{domain}/networking/rest/user/b2912a93cb0e" 
	    displayValue="Smith;;Mary">b2912a93cb0e</modified_id>
        <object_id>2b934310dbd24347813a722ab8724eb3</object_id>
        <record_id>1381445705</record_id>
        <id>e8cfbadc9ae547bb85e1bd86abca8ac5</id>
        <name>action1</name>
        <title>action1</title>
        <currentStateId>38c8725a13e04ec08796f1b0791da071</currentStateId>
        <nextStateId>90e2323956e24c0a8e475fce4ae19ca8</nextStateId>
        <notifyRecordOwner>0</notifyRecordOwner>
        <customCriteria></customCriteria>
        <actionCriteria>
            <criteria_1_join_operator></criteria_1_join_operator>
            <criteria_1_pre_bracket></criteria_1_pre_bracket>
            <criteria_1_post_bracket></criteria_1_post_bracket>
            <criteria_1_column>amount</criteria_1_column>
            <criteria_1_operator>gt</criteria_1_operator>
            <criteria_1_value>500</criteria_1_value>
            <criteria_2_join_operator></criteria_2_join_operator>
            <criteria_2_pre_bracket></criteria_2_pre_bracket>
            <criteria_2_post_bracket></criteria_2_post_bracket>
            <criteria_2_column></criteria_2_column>
            <criteria_2_operator></criteria_2_operator>
            <criteria_2_value></criteria_2_value>
            <criteria_3_join_operator></criteria_3_join_operator>
            <criteria_3_pre_bracket></criteria_3_pre_bracket>
            <criteria_3_post_bracket></criteria_3_post_bracket>
            <criteria_3_column></criteria_3_column>
            <criteria_3_operator></criteria_3_operator>
            <criteria_3_value></criteria_3_value>
            <criteria_4_join_operator></criteria_4_join_operator>
            <criteria_4_pre_bracket></criteria_4_pre_bracket>
            <criteria_4_post_bracket></criteria_4_post_bracket>
            <criteria_4_column></criteria_4_column>
            <criteria_4_operator></criteria_4_operator>
            <criteria_4_value></criteria_4_value>
            <criteria_5_join_operator></criteria_5_join_operator>
            <criteria_5_pre_bracket></criteria_5_pre_bracket>
            <criteria_5_post_bracket></criteria_5_post_bracket>
            <criteria_5_column></criteria_5_column>
            <criteria_5_operator></criteria_5_operator>
            <criteria_5_value></criteria_5_value>
        </actionCriteria>
        <available>0</available>
    </workflowAction>
    <workflowAction>
        <date_created>2010-11-12T13:14:15Z</date_created>
        <date_modified>2010-11-12T13:14:15Z</date_modified>
        <created_id type="" 
	    uri="https://{domain}/networking/rest/user/b2912a93cb0e" 
	    displayValue="Smith;;Mary">b2912a93cb0e</created_id>
        <modified_id type="" 
	    uri="https://{domain}/networking/rest/user/b2912a93cb0e" 
	    displayValue="Smith;;Mary">b2912a93cb0e</modified_id>
        <object_id>2b934310dbd24347813a722ab8724eb3</object_id>
        <record_id>1381445705</record_id>
        <id>24b410913f9e47cb96fe69aa68e34a47</id>
        <name>action1</name>
        <title>action1</title>
        <currentStateId>38c8725a13e04ec08796f1b0791da071</currentStateId>
        <nextStateId>517071981f5d4708ab1739d320804210</nextStateId>
        <notifyRecordOwner>0</notifyRecordOwner>
        <customCriteria></customCriteria>
        <actionCriteria>
            <criteria_1_join_operator></criteria_1_join_operator>
            <criteria_1_pre_bracket></criteria_1_pre_bracket>
            <criteria_1_post_bracket></criteria_1_post_bracket>
            <criteria_1_column>amount</criteria_1_column>
            <criteria_1_operator>gt</criteria_1_operator>
            <criteria_1_value>100</criteria_1_value>
            <criteria_2_join_operator>and</criteria_2_join_operator>
            <criteria_2_pre_bracket></criteria_2_pre_bracket>
            <criteria_2_post_bracket></criteria_2_post_bracket>
            <criteria_2_column>amount</criteria_2_column>
            <criteria_2_operator>lteq</criteria_2_operator>
            <criteria_2_value>500</criteria_2_value>
            <criteria_3_join_operator></criteria_3_join_operator>
            <criteria_3_pre_bracket></criteria_3_pre_bracket>
            <criteria_3_post_bracket></criteria_3_post_bracket>
            <criteria_3_column></criteria_3_column>
            <criteria_3_operator></criteria_3_operator>
            <criteria_3_value></criteria_3_value>
            <criteria_4_join_operator></criteria_4_join_operator>
            <criteria_4_pre_bracket></criteria_4_pre_bracket>
            <criteria_4_post_bracket></criteria_4_post_bracket>
            <criteria_4_column></criteria_4_column>
            <criteria_4_operator></criteria_4_operator>
            <criteria_4_value></criteria_4_value>
            <criteria_5_join_operator></criteria_5_join_operator>
            <criteria_5_pre_bracket></criteria_5_pre_bracket>
            <criteria_5_post_bracket></criteria_5_post_bracket>
            <criteria_5_column></criteria_5_column>
            <criteria_5_operator></criteria_5_operator>
            <criteria_5_value></criteria_5_value>
        </actionCriteria>
        <available>0</available>
    </workflowAction>
    <message>
        <code>0</code>
        <description>Success</description>
    </message>
    <recordCount>3</recordCount>
</platform>
See also: REST API:Error Codes

Fields

Name Type Attributes Required During Add Description Additional Information
id String Read Only Unique identifier of the action
name String Workflow action name
title String Workflow action title
currentStateId String WorkflowAction current state unique identifier
nextStateId String WorkflowAction next state unique identifier
notifyRecordOwner String Notify the Record Owner about the workflow action being taken, available values: 0, 1
customCriteria String Advanced criteria; learn more: Action Criteria in Workflows
actionCriteria Struct Basic criteria; learn more: Action Criteria in Workflows Contains a set of fields for each criteria, where the criteria are numbered from 1 to N:
  • <criteria_1_join_operator>
  • <criteria_1_pre_bracket>
  • <criteria_1_post_bracket>
  • <criteria_1_column>
  • <criteria_1_operator>
  • <criteria_1_value>
     ...
additionalUserToNotify String List of additional users to notify upon taking the action One for every additional user to notify
available String Eligibility of the workflow action (does the record fit the criteria?)

Available values: 0, 1

date_modified Date Read Only Date the record was last modified UTC Format
modified_id Lookup Read Only Unique identifier of the user who last modified the record
date_created Date Read Only Date the record was created UTC Format
created_id Lookup Read Only Unique identifier of the the user who created the record

Transition a Record to a New State

Take one of the available actions on a record to transition to a new state.

Requirements
  • User must be a workflow owner for the record
  • The workflow must allow the specified action
Method
POST
URI
https://na.longjump.com/networking/rest/record/{objectName}/{recordId}/operation/changeWorkflowState</nowiki>
Request
<platform>
    <workflowChangeState>
        <workflowIdOrName>workflow1</workflowIdOrName>
        <actionName>approve</actionName>
        <comment>approve comment</comment>
        <userChoiceOwner>John Doe</userChoiceOwner>
    </workflowChangeState>
</platform>
Response
<platform>
    <message>
        <code>0</code>
        <description>Success</description>
    </message>
</platform>

Fields

Name Type Attribute Required During POST Description Additional Information
objectId String Read Only Unique object identifier
record_id String Read Only Unique record identifier
workflowIdOrName String Checkmark.gif Workflow ID or name
actionName String Checkmark.gif Workflow action name
comment String comment on taken action
userChoiceOwner String If required indicate next workflow owner
date_modified String Read Only Date the record was last modified
date_created String Read Only Date the record was created
created_id IDBean Read Only ID of user who created the record
modified_id IDBean Read Only ID of user who last modified the record