Example

Consider an example to understand how to use Run Workflow with the help of an example.

About this task

Consider that you want to create a workflow whenever a new contact is created in Zoho CRM. Also, check whether contact type is Customer or Employee and post the contact details on the relevant Slack channel.

This scenario can be covered by using 2 workflows:

  • Main workflow

    Whenever a Zoho CRM contact is created. It checks whether the contact type is customer or employee. If the contact type is Customer, it posts the customer details on a specific Slack channel and if the contact type is Employee, it calls the sub-workflow. After it receives the Trello membership details from the sub-workflow, it will post its details on a specific Slack channel.

  • Sub-workflow

    Sub-workflow use employee's Zoho contact details to add them as a member to a specific Trello board and then send Trello membership details back to the main workflow.

    Steps that are required to create and configure these workflows.

Procedure

  1. Set up webhook for sub-workflow

    The Run Workflow action requires the webhook of the sub-workflow to trigger it. So, before you configure the Run Workflow action, it is necessary to set up a webhook for the workflow you want to call. To do,

    1. Create a blank workflow, double-click the Start icon, and set up a webhook (know more about Return Data on Sync Webhook).
    2. Click Next. In the next screen, toggle-on the Autoconnect switch to automatically connect the Return Data on Sync Webhook action to the end of the workflow. This action helps you send the response of the workflow back to the webhook (know more about how Return Data on Sync Webhook).
    3. Toggle-on the Autoconnect as you want to send the details of an employee's Trello membership to the main workflow,
    4. Click Next, and then click Done. It takes you back to the canvas. You can see that the Return Data on Sync Webhook action is automatically connected just before the Stop icon in the workflow.
    5. Connect the Start icon (now having the webhook icon) to Return Data on Sync Webhook action, test the action, and Save the workflow.
    6. Configure the rest of the sub-workflow later.
  2. Create the main workflow
    Create the main workflow where whenever a new Zoho CRM contact is created, the workflow checks whether the contact type is Customer or Employee. If the contact type is Customer, it posts the customer's Zoho contact details on a specific Slack channel and if the contact type is Employee, it calls the sub-workflow. When the sub-workflow adds the employee as a member to the Trello board and sends the membership details back to the main workflow, the main workflow posts the employee's Zoho contact details and Trello membership details on a specific Slack channel.
    Add and configure the Zoho CRM - New Contact trigger, and Slack - Post Message to Channel, Run Workflow, and Slack - Post Message to Channel actions as given below:
    1. Workflow Configuration
      • Zoho CRM - New Contact- Select the New Contact trigger and the Zoho CRM account that you want to use to set up the trigger. You can alternatively create a new Zoho CRM account.
      • Slack - Post New Message- Select the relevant Slack account and channel on which you want to post the customer's Zoho contact details. In the Textfield, add the Full_Name, Email, and Owner.name keys.
      • Condition 1 for Zoho CRM - New Contact triggerand Post New Message action- if the contact description is Customer, run the Slack - Post New Message action.

        Input: Add the description key listed under the list of trigger output in the left-side window. For example, {{$trigger.Description}}

        Condition: (Text) Exactly Matches

        Expected: Customer

      • Run Workflow- Set up the Run Workflow action for the workflow you want to call.

        Webhook URL- Select the webhook URL for the sub-workflow you want to call. Doing so, automatically renders the input fields that are associated with the payload data for the selected webhook.

        Note: If the sync field is not visible in your Run Workflow action configuration form. Verify that you tested the Return Data on Sync Webhook action in the first step according to the instructions.

        Add the Email key and Full_Name key in the Name and Email ID fields.

        Sync- Because you want to run this workflow in sync, that is, fetch the response of the subflow and use it in this workflow, set the value of this field to true.

        Click Next, optionally Test the action, and click Done. It takes you back to the canvas.

      • Condition 2 for Zoho Contacts - New Contact trigger and Run Workflow action- When the contact description is <term>Employee</term>, run the Slack - Post New Message action.

        Input - Add the description key listed under the list of trigger output in the left-side window. For example, {{$trigger.Description}}

        Condition - (Text) Exactly matches

        Expected - Employee

      • Slack - Post New Message - Select the relevant Slack account and channel on which you want to post the employee's Zoho contact details and Trello membership details.

        Because you want to use the output of the subflow to post the employee contact details on the Slack channel, add the response key that is listed under the Run Workflow action output in the Textfield.

        Click Next, optionally Test the action, and click Done. It takes you back to the canvas.

        Click Saveto save the workflow.

  3. Configure the sub-workflow

    The sub-workflow uses employee's Zoho contact details to add them to a Trello board and then send the details of the Trello board back to the main workflow.

    Open the sub-workflow for which you set webhook earlier, add the Trello - Add Member to Board action between the webhook trigger and the Return Data on Sync Webhook action. Configure the following.

    Workflow Configuration

    • Trello - Add Member to Board- Because you want to use the parameters passed by the Run Workflow, that is, the email ID and employee name to add the employee as a Trello board member, add the Nameand Email ID keys that are listed under the Webhook output in the Full Nameand Email ID fields.

    • Return Data on Sync Web hook- In the Response Data field, Send the Employee details that you want to send back to the main workflow.

      In our example, you send employee name, employee email ID, and employee's Trello membership ID to the main workflow. To do so, add the idMember, fullName, member_email_id keys in the Response Data field.

      Click Next, Test the action, and click Done. It takes you back to the canvas.

      After this, Save the workflow.

  4. Execute the main workflow

    With this, both workflows are configured successfully. Now, whenever a new contact is created in your Zoho CRM account. The following sequences of actions take place:

    1. The main workflow compares whether the newly created Zoho CRM contact type is Customer or Employee.
    2. If the contact type is Customer, the main workflow posts the details of the customer's Zoho contact on a specified Slack channel.
    3. If the contact type is Employee, the main workflow calls the sub-workflow and passes the name and email ID of the employee to the webhook of the sub-workflow.
    4. The sub-workflow fetches the name and email ID of the employee from the webhook and use it to add the employee as a member in a specific Trello board. After the employee is added as a member in the Trello board, the sub-workflow sends the employee's name, email ID and Trello membership details back to the main workflow.
    5. Finally, the main workflow fetches the response (employee details) sent by the subflow and posts it on the specified Slack channel.