Lab Resources

Compound action workflow syntax


Accessing data payloads in workflows

All data is accessible under the root field “data” as seen below in the JSON example.

Fields at the “data” level (description, subject, and type) can be accessed by referencing the next level using a “.”

Examples:

  • To access description the syntax would be: data.description
  • To access the jira issue key the syntax would be: data.jira_issue.key


API calls

Salesforce

Create case

curl --location 'https://deepnets2-dev-ed.develop.my.salesforce.com/services/data/v59.0/sobjects/Case' \
--header 'Content-Type: application/json' \
--data '{
 "AccountId": "{{account_id}}",
 "Subject": "Customer says its not working",
 "Description": "testing it out again"
}'

Update case

curl --location --request PATCH 'https://deepnets2-dev-ed.develop.my.salesforce.com/services/data/v59.0/sobjects/Case/500aj00000Jl4reAAB'
--header 'Content-Type: application/json' \
--data '{"Comments":"https://deep-nets-team.atlassian.net/browse/KAN-11"}'

Jira

JIRA - Create issue

Hint: JIRA uses Basic Authentication. The username will be your JIRA username from your trial instance and the password will be the token you generated earlier in the exercise.

curl --location 'https://deep-nets-team.atlassian.net/rest/api/2/issue' \
--header 'Content-Type: application/json' \
--data '{
 "fields":
{
   "summary": "Add something to the Kanban board",
   "description": "testing it out again",
   "project":
{
     		"key": "KAN"
   	},
   "issuetype":
{
     		"name": "Task"
   	}
 },
 "update": {}
}'

Azure

Get groups

curl --location 'https://graph.microsoft.com/v1.0/groups?%24top=10'
                                                                                                                                                                                                                   

Filter groups

curl --location 'https://graph.microsoft.com/v1.0/groups?%24filter=startswith(displayName%2C%20%27demo%27') 

Add user to group

curl --location 'https://graph.microsoft.com/v1.0/groups/{{group_id}}/members/$ref' \
--header 'Content-Type: application/json' \
--data-raw '{
 "@odata.id": "https://graph.microsoft.com/v1.0/directoryObjects/{{user_id}}"
}'

Get groups for a user

curl --location 'https://graph.microsoft.com/v1.0/users/{{user_email_address}}/memberOf?%24filter=mailEnabled%20eq%20true&%24count=true' \
--header 'ConsistencyLevel: eventual'

Advanced concepts

Error handling

Error handling documentation can be found here: Error Handling

Try-catch

If you are familiar with try-catch statements, you can utilize the below skeleton

- try_catch:
   catch:
     on_status_code:
       - 400
     steps:
       - raise:
           message: Error message to display
           output_key: data_error_key
   try:
     - action:
         output_key: group_result
         action_id: action_id
         progress_updates:
           on_complete: On complete message
           on_pending: On pending message
         input_args:
           arg_1: argument