Compound Action Examples

View as Markdown

These examples show how data moves between slots and actions.

Get Salesforce Accounts by Name (Single Action, Return)

This compound action performs a single action called get_account_info which calls the Salesforce SOQL API to fetch accounts passing in account_nameas the slot to be used as the query.

Compound Action

1steps:
2 - action:
3 output_key: account_info
4 action_name: get_account_info # the action that fetches accounts by name
5 progress_updates:
6 on_complete: Found info for {{data.account_name}}
7 on_pending: Searching Salesforce for {{data.account_name}}
8 input_args:
9 account_name: data.account_name
10 - return:
11 output_mapper:
12 # if no results are returned the values will evaluate to ""
13 description: data.account_info.records[0].Description
14 account_id: data.account_info.records[0].Id

Create Salesforce Case & Sync to JIRA

This compound action implements a cross-platform case management workflow that creates linked tickets in both Salesforce and JIRA:

  1. Creates a Salesforce case with:
    1. Description
    2. subject
    3. account ID
    4. Case type from input data
  2. Creates a corresponding JIRA issue with:
    1. Same description and subject as the Salesforce case
    2. Captures the JIRA issue key from the generated case for linking
  3. Links the two systems by:
    1. Updating the original Salesforce case with a comment/field containing the JIRA URL
    2. Constructs the full JIRA URL using the Moveworks DSL $CONCAT function: https://company.atlassian.net/browse/[JIRA-KEY]]`

Compound Action

1steps:
2 - action:
3 output_key: case_info
4 action_name: create_sfdc_case
5 progress_updates:
6 on_complete: Created a new case in Salesforce
7 on_pending: Creating a new case in Salesforce
8 input_args:
9 description: data.description
10 subject: data.subject
11 account_id: data.account_id
12 type: data.type
13 - action:
14 output_key: jira_issue
15 action_name: create_jira_issue
16 progress_updates:
17 on_complete: Added Issue to JIRA
18 on_pending: Adding Issue to JIRA
19 input_args:
20 description: data.description
21 subject: data.subject
22 - action:
23 output_key: case_update
24 action_name: update_sfdc_case
25 progress_updates:
26 on_complete: Updated Case Object
27 on_pending: Adding JIRA Link to Case Comment
28 input_args:
29 case_id: data.case_info.id
30 jira_link: $CONCAT(["https://company.atlassian.net/browse/",
31 data.jira_issue.key])

Onboard Users (Multi Action, Switch, Return)

Slots

  • username
  • firstName
  • lastName
  • companyName
  • groupName
  • managerName
  • managerEmail

Compound Action

1steps:
2 - action:
3 output_key: msgraph_user
4 action_name: add_username_to_azure
5 progress_updates:
6 on_complete: Added {{data.username}} to Azure
7 on_pending: Attempting to add {{data.username}} to Azure
8 input_args:
9 companyName: data.companyName
10 fullName: $CONCAT([data.firstName, data.lastName], " ", TRUE)
11 firstName: data.firstName
12 username: IF data.username THEN $CONCAT([data.username,
13 "@moveworksai.onmicrosoft.com"]) ELSE NULL
14 - switch:
15 cases:
16 - steps:
17 - action:
18 output_key: group_info
19 action_name: get_group_info
20 progress_updates:
21 on_complete: Found {{data.groupName}} in Azure
22 on_pending: Looking up group in Azure by name
23 input_args:
24 groupName: data.groupName
25 - action:
26 output_key: add_user_to_group_result
27 action_name: add_user_to_group
28 progress_updates:
29 on_complete: Added {{data.username}} to Azure Group
30 on_pending: Adding user to group
31 input_args:
32 groupId: data.group_info.value[0].id
33 userId: data.msgraph_user.id
34 condition: data.groupName
35 - action:
36 output_key: jira_customer
37 action_name: add_username_to_jira
38 progress_updates:
39 on_complete: Added {{data.username}} to JIRA
40 on_pending: Attempting to add {{data.username}} to JIRA
41 input_args:
42 email: IF data.username THEN $CONCAT([data.username,
43 "@moveworksai.onmicrosoft.com"]) ELSE NULL
44 displayName: $CONCAT([data.firstName, data.lastName], " ", TRUE)
45 - action:
46 output_key: okta_user
47 action_name: add_username_to_okta
48 progress_updates:
49 on_complete: Added {{data.username}} to Okta
50 on_pending: Attempting to add {{data.username}} to Okta
51 input_args:
52 username: IF data.username THEN $CONCAT([data.username,
53 "@moveworksai.onmicrosoft.com"]) ELSE NULL
54 lastName: data.lastName
55 firstName: data.firstName
56 managerEmail: data.managerEmail
57 managerName: data.managerName
58 - return:
59 output_mapper:
60 lastName: data.lastName
61 firstName: data.firstName

Lookup Google Calendar Events (Action, Script Action, Return)

This compound action takes in 2 slots start_date and end_date and performs a Google Calendar REST API call to retrieve events, and data cleaning:

  1. Fetches calendar events from Google Calendar API using the specified date range (timeMin to timeMax) from the input slots.
  2. Cleans and filters the event data using a Python script that:
    1. Takes the raw calendar events from gcal_output.items Extracts only 3 specific fields from each event:
      1. htmlLink - URL to view the event in Google Calendar
      2. description - Event description text
      3. summary - Event title/summary
  3. Removes all other event metadata (attendees, location, timestamps, etc.)
  4. Returns the simplified event list as an object called final_events

Compound Action

1steps:
2 - action:
3 action_name: fetch_gcal_events
4 input_args:
5 timeMin: data.start_date
6 timeMax: data.end_date
7 output_key: gcal_output
8 - script:
9 output_key: cleaned_events
10 input_args:
11 events: data.gcal_output.items
12 code: "[{'htmlLink': event.get('htmlLink'), 'description':
13 event.get('description'), 'summary': event.get('summary')} for event in
14 events]"
15 - return:
16 output_mapper:
17 final_events: data.cleaned_events

Grant Copilot License & Remove after 7 days (Action, Action w/ Delay Config, Action, Return)

This compound action below implements a temporary Microsoft Copilot license assignment workflow with the following sequence:

  1. Assigns a Microsoft Copilot license to the user (using their email address from metadata)
  2. Sends an immediate notification to the user confirming the license assignment and warning that it will be automatically removed in 7 days
  3. Waits 7 days by leveraging a delay_config, then automatically removes the Copilot license from the user’s account
  4. Returns a final message to inform the user that their license has been removed and they can request access again if needed

This workflow is useful for temporary trial access or short-term license provisioning, ensuring licenses don’t remain assigned indefinitely and providing clear communication to users about the temporary nature of their access.

Compound Action

steps:
- action:
action_name: ms_graph_assign_copilot_license
input_args:
userPrincipalName: meta_info.user.email_addr
output_key: ms_graph_assign_copilot_license_result
- action:
action_name: mw.send_plaintext_chat_notification
input_args:
message: '"You have been successfully assigned a Microsoft Copilot License it
will be removed in 7 days"'
user_record_id: meta_info.user.id
output_key: send_plaintext_chat_notification_result
- action:
output_key: ms_graph_remove_copilot_license_result
action_name: ms_graph_remove_copilot_license
delay_config:
days: "7"
input_args:
userPrincipalName: meta_info.user.email_addr
- return:
output_mapper:
message_to_user: '"The license for Microsoft Copilot has been removed from your
account if you need access again please ask Me, TELL THE USER THE
LICENSE WAS REMOVED NOT ASSIGNED"'