Compound Actions Examples
Get Salesforce Accounts by Name (Single Action, Return)
steps:
- action:
output_key: account_info
action_name: get_account_info # the action that fetches accounts by name
progress_updates:
on_complete: Found info for {{data.account_name}}
on_pending: Searching Salesforce for {{data.account_name}}
input_args:
account_name: data.account_name
- return:
output_mapper:
description: data.account_info.records[0].Description
account_id: data.account_info.records[0].Id
Where the account_name is an input variable
Create Salesforce Case & Sync to JIRA
steps:
- action:
output_key: case_info
action_name: create_sfdc_case
progress_updates:
on_complete: Created a new case in Salesforce
on_pending: Creating a new case in Salesforce
input_args:
description: data.description
subject: data.subject
account_id: data.account_id
type: data.type
- action:
output_key: jira_issue
action_name: create_jira_issue
progress_updates:
on_complete: Added Issue to JIRA
on_pending: Adding Issue to JIRA
input_args:
description: data.description
subject: data.subject
- action:
output_key: case_update
action_name: update_sfdc_case
progress_updates:
on_complete: Updated Case Object
on_pending: Adding JIRA Link to Case Comment
input_args:
case_id: data.case_info.id
jira_link: $CONCAT(["https://deep-nets-team.atlassian.net/browse/",
data.jira_issue.key])
Onboard Users (Multi Action, Switch, Return)
steps:
- action:
output_key: msgraph_user
action_name: add_username_to_azure
progress_updates:
on_complete: Added {{data.username}} to Azure
on_pending: Attempting to add {{data.username}} to Azure
input_args:
companyName: data.companyName
fullName: $CONCAT([data.firstName, data.lastName], " ", TRUE)
firstName: data.firstName
username: IF data.username THEN $CONCAT([data.username,
"@moveworksai.onmicrosoft.com"]) ELSE NULL
- switch:
cases:
- steps:
- action:
output_key: group_info
action_name: get_group_info
progress_updates:
on_complete: Found {{data.groupName}} in Azure
on_pending: Looking up group in Azure by name
input_args:
groupName: data.groupName
- action:
output_key: add_user_to_group_result
action_name: add_user_to_group
progress_updates:
on_complete: Added {{data.username}} to Azure Group
on_pending: Adding user to group
input_args:
groupId: data.group_info.value[0].id
userId: data.msgraph_user.id
condition: data.groupName
- action:
output_key: jira_customer
action_name: add_username_to_jira
progress_updates:
on_complete: Added {{data.username}} to JIRA
on_pending: Attempting to add {{data.username}} to JIRA
input_args:
email: IF data.username THEN $CONCAT([data.username,
"@moveworksai.onmicrosoft.com"]) ELSE NULL
displayName: $CONCAT([data.firstName, data.lastName], " ", TRUE)
- action:
output_key: okta_user
action_name: add_username_to_okta
progress_updates:
on_complete: Added {{data.username}} to Okta
on_pending: Attempting to add {{data.username}} to Okta
input_args:
username: IF data.username THEN $CONCAT([data.username,
"@moveworksai.onmicrosoft.com"]) ELSE NULL
lastName: data.lastName
firstName: data.firstName
managerEmail: data.managerEmail
managerName: data.managerName
- return:
output_mapper:
lastName: data.lastName
firstName: data.firstName
Lookup Gcal Events (Action, Script Action, Return)
steps:
- action:
action_name: 9f3062bc-5ed1-4b56-aaa4-022d1514bb0c
input_args:
timeMin: data.start_date
timeMax: data.end_date
output_key: gcal_output
- script:
output_key: cleaned_events
input_args:
events: data.gcal_output.items
code: "[{'htmlLink': event.get('htmlLink'), 'description':
event.get('description'), 'summary': event.get('summary')} for event in
events]"
- return:
output_mapper:
final_events: data.cleaned_events