activities
latest
false
UiPath logo, featuring letters U and I in white
Integration Service Activities
Last updated Nov 5, 2024

Use Slack Buttons when an opportunity is won in the CRM system

About

Summary: Use Slack Buttons when an opportunity is won in the CRM

Applications: Slack, Salesforce

Description

Slack buttons allow you to create an inbuilt review/approval mechanism and trigger automations from Slack messages by just clicking a button. Anyone can effectively use human intervention at key decision or touch points and choose among 1-5 automations (with the help of 1-5 buttons) involving complex systems such as CRM, ERP, ITSM, HR, Finance, etc., by triggering them from Slack messages, without logging into that respective system.

Here are some key use cases taking advantage of Slack buttons:

  1. When an opportunity is closed and won in Salesforce, choose whether to initiate or create an invoice or a sales order in QuickBooks or NetSuite, or send a sales agreement via DocuSign, or email a supplier via Outlook, by triggering the respective automation with the help of a Slack button.
  2. When a time-off request is raised in an HR tool such as Bamboo HR, approve or deny the time-off request with the help of a Slack button.
  3. When an expense report or claim is created in SAP Concur, approve or reject the report with the help of a Slack button.
  4. When a customer support request is raised in the help channel of Slack, create a Jira/Zendesk ticket or notify the team or user group with the help of a Slack button.
  5. Every week, using a time-based trigger, create an email campaign in Mailchimp and send a test email for manager or peer review, who in turn can approve or reject the scheduling or sending of the email campaign to the target audience with the help of a Slack button.
  6. When a GitHub pull request (PR) is raised for peer review, approve or reject the PR with the help of a Slack button.
In this user guide, we are using two workflows to build the first use case.
docs image

The first workflow uses Slack activities, such as Send Message to Channel, and the Salesforce: Opportunity Closed and Won trigger.

The second workflow uses Slack activities, such as Send Button Response, Send Reply, and Button Clicked, along with Salesforce activities, such as Get Account, Get Opportunity, and Search Records, an Oracle NetSuite Create Basic Company Customer activity, and Create Envelope Using Template from DocuSign.

First workflow

Note: If you want to save time, use the Send a Slack button message when an opportunity is won in Salesforce template in Studio Web to build this workflow.
  1. Open Studio Web and create a new project.

  2. Select the More options menu on the Manual trigger and select Change trigger.

  3. From the trigger catalog, select Salesforce: Opportunity Closed and Won. In this trigger activity:

    1. Set up your Salesforce connection.
    2. Add any additional filters, if needed.
    3. You can also rename the trigger activity to something more representative of your use case.


  4. Add the Slack Send Message to Channel activity to your workflow. At this step, you want to pass the output of the previous trigger activity as variables in the Slack message. In the activity:
    1. In the Channel field, select the respective channel from the drop-down list or enter the exact channel name (without #).
    2. In the Message field, type the main section text message. For example: "Congratulations team! We have won the below opportunity."
    3. In the Send as field, select either Bot, to send the message as a bot, or User, to send the message as the current authenticated user on Slack.
    4. In the Message fields, enter the opportunity ID and name in key:value pairs, separated by a comma. Change the label of Opportunity ID and Opportunity Name to bold using Slack markdown formatting For example:

      *Opportunity ID*:<opportunity ID>;

      *Opportunity Name*:<opportunity name>

      • where <opportunity ID> and <opportunity name> are variables retrieved from Salesforce trigger.


    5. In the Buttons actions fields, enter two button actions for Approve Invoice and Send Sales Agreement. Add the action ID (required), action name (required), style (primary/danger), confirmation title, confirmation text, confirm ok title, confirm deny title, in a comma-separated format:
      aks1,Approve Invoice,primary; 
      aks2,Send Sales Agreement,danger,Confirm,Are u sure?,Yes,Noaks1,Approve Invoice,primary; 
      aks2,Send Sales Agreement,danger,Confirm,Are u sure?,Yes,No
  5. You are now ready to publish or run the project. Select the Publish button at the top of the workflow and enter the details such as Automation name, Description, and Workspace. The Version is updated automatically.


Second workflow

Note: If you want to save time, use the Configure/trigger an automation when a button is clicked on Slack for the closed/won opportunity in Salesforce template in Studio Web to build this workflow.
  1. Open Studio Web and create a new project.

  2. Select the More options menu on the Manual trigger and select Change trigger.

  3. From the trigger catalog, select Slack: Button Clicked. In this trigger activity:
    1. Set up your Slack connection.
    2. It is mandatory to select either a Channel or a User for this trigger, to restrict the button events to a particular channel or from a particular user.
    3. Add any additional filters, if needed.
    4. You can also rename the trigger activity to something more representative of your use case.


  4. Add the Salesforce Get Opportunity activity to your workflow. In the first workflow, we entered the opportunity ID and opportunity name as a Slack message field. The same information must be retrieved from the Button Clicked output response. In the activity:
    1. For the Opportunity field, select See more docs image icon to change input type and select Use variable. Under the Button Clicked output, search for the field > field2_text property. This is the value of Opportunity ID.
      Note: In the first workflow, message fields are passed in key:value pairs separated by a comma. Each message field in the Button Clicked response (irrespective of key or value) will be sequentially assigned, i.e. if key1:value1; key2:value2; key3:value3 were passed in Message fields, key1 is assigned to field1, value1 is assigned to field2, key2 is assigned to field3, value3 is assigned to field4, key3 is assigned to field5, value3 is assigned to field6 and so on.


  5. Add a Salesforce Get Account activity to your workflow. At this step, you want to pass the output of previous activity as input for retrieving the primary account details. In the activity:
    1. For the Account field, select See more docs image icon to change input type and select Use variable. Under the Get opportunity output, select the Id property.


  6. Add an If activity to your workflow. Now you want to filter or add an if condition to check on the Slack button that was clicked. In this activity:
    1. Select the Condition field, select See more docs image icon to change input type and select Use variable. Under the Button clicked output, select Button actions1 > text property.
    2. Select the Equals operator.
    3. For the third column, type "Approve Invoice". Remember that in the first workflow we passed Approve Invoice as one of the button action names.
    4. Click Save.


  7. For the Then branch, add the Oracle NetSuite Create Basic Company Customer activity to your workflow. At this step, you want to pass the output of the previous Get Account activity as input for creating a customer record in NetSuite. In the activity:
    1. For the Name field, select See more docs image icon to change input type and select Use variable. Under the Get account response, select the name property.
    2. For the Subsidiary field, select any of the available options.
    3. For the Phone field, select See more docs image icon to change input type and select Use variable. Under the Get account response, select the phone property.


  8. Still under the Then branch, add a Slack Send Button Response activity. At this step, you want to use the Response URL output of the Button Clicked trigger as input for replacing/deleting the original Button message sent in the first workflow. This restricts the button click to a one time only and not allow multiple button clicks. In the activity:
    1. Select Button response URL, select See more docs image icon to change input type and select Use variable. Under the Button Clicked response, select the Button > response URL property.
    2. For the Response type field, select In channel. This sends a message in the channel that can be seen by others. The Ephemeral option is used to send a message that can be seen only by the user who clicked the button and not others in the channel.
    3. Set the Replace original field to True, to replace the original button message (sent in the first workflow).
    4. For the Message field, type a message by dynamically passing the user name who clicked the button and the NetSuite customer created in the previous step. For example:

      "<username> has approved the creation of <customer name> in NetSuite for Sales Order or Invoice processing"



  9. Next, for the Else branch of the If activity, add a Salesforce Search Records activity to your workflow. At this step, you want to retrieve the primary contact name and email of the customer retrieved in the Get Account. In the activity:
    1. For the Select object field, select Contact.
    2. Select Manage Properties, select Where and click Update fields.
    3. Select the Where field, now displayed on the canvas, to open the filter builder.
      1. In the first column, select Account ID.
      2. Select the Equals (=) operator.
      3. For the third column, use a variable. Select the Id property under the Get account response.
      4. Click Save.


  10. Still under the Else branch, add a DocuSign Create Envelope Using Template activity to your workflow. Now you pass the primary contact name and email of the customer to send a sales agreement for e-sign. In the activity:
    1. For the Template field, select the respective template for sales agreement.
    2. For the Status field, select Send to create and send the envelope for signature. The Draft option only creates the envelope in draft but doesn't send it.
    3. For the Email subject field, type the respective subject. For example: "Welcome to our family! Please sign the Sales Agreement!".
    4. For the Recipient legal name field, select See more docs image icon to change input type and select Use variable. Under the Search Records response, select First Contact Record > Name property.
    5. For the Recipient email field, select See more docs image icon to change input type and select Use variable. Under the Search Records response, select First Contact Record > Email property.


  11. In the same Else branch, add the Slack Send Reply activity to your workflow. At this step, you want to pass the user name, channel ID, message timestamp of the Button Clicked event and account, opportunity information from the previous Salesforce activities. In the activity:
    1. For the Channel field, select See more docs image icon to change input type and select Use variable. Under the Button Clicked response, select Button > channel id property.
    2. For the Message timestamp field, select See more docs image icon to change input type and select Use variable. Under the Button Clicked response, select Button > message ts property.
    3. For the Message field, type a message by dynamically passing the user name who clicked the button, the account name, and the opportunity name and ID. For example:

      "<username> has sent the sales agreement to the <account name> for the below opportunity: <opportunity ID> - <opportunity name>"

      • where <username> is retrieved from the Button Clicked response, <account name> is retrieved from Get Account, and <opportunity ID> and <opportunity name> are retrieved from Get Opportunity response.


  12. You are now ready to publish or run the project. Select the Publish button at the top of the workflow and enter the details such as Automation name, Description, and Workspace. The Version is updated automatically.


  • About
  • First workflow
  • Second workflow

Was this page helpful?

Get The Help You Need
Learning RPA - Automation Courses
UiPath Community Forum
Uipath Logo White
Trust and Security
© 2005-2024 UiPath. All rights reserved.