Update Opportunities with Order Details

This is the last step to your flow. You want to make sure that NTO sales reps are up to date with the Order information for any of their opportunities. Best way to keep them updated is to keep NTO’s Salesforce instance updated with the OrderID. With just a few steps, you can update the Opportunity record in Salesforce with the OrderID that you just got from the API. Here is how:

  1. Click the plus sign sign before the transform card that formats data for Twilio and add a Set Variable module with these details.
    • For Name, enter OrderDetails
    • For the value, click the f(x) button and enter payload
      Image showing where to add the Set Variable card within the flow
  2. Now on click the plus sign to the right side of Twilio card and add a new transform card. Open the transform card.
  3. Collapse the payload in the Input section (left side). You’ll see OrderDetails and OppDetails under vars section.
  4. Click the card options next to OrderDetails, and set the type to Order Tracking.
  5. Click the card options next to OppDetails, and set the type to Salesforce Opportunity.
  6. Close the card and add a new Salesforce connector to your flow. Select Update as the operation.
  7. Click card options  from the top right of the box and select Refresh. This causes DataSense to fetch data from Salesforce.
  8. A dropdown for Type appears. Select Opportunity and go back to the Transform card.
    Note: If you don’t see fields in the Output section, refresh the card. You’ll see Input and Output fields both populated as shown below.
    Image showing the Transform card which is added after the Twilio connector card
  9. Drag the Id from OppDetails in the Input to the Id on the Output.
  10. Drag the OrderID from Input to the OrderNumber__c on the Output.

Time to Test

Now that you have everything set up, take your MuleSoft application for a spin. Here’s how to test it.

  1. Make sure there are no outstanding errors. If there are errors, read the descriptions and verify your steps from the guide. You can also open the logs from the taskbar at the bottom to investigate errors.
  2. Verify you’ve entered your phone number on the To field in the Transform card that transforms data for the Twilio connector.
  3. If there are no errors and the Run button is available, run the application. Once it’s running, you’ll see a green check mark saying Latest changes applied.
  4. Log in to your Salesforce instance using the credentials you used in the connector. Click app switcher  to open the App Launcher, and select Sales.
  5. Click Opportunities and change the view to All Opportunities using the dropdown.
  6. Find an opportunity that does not have the Closed Won stage.
  7. Open the opportunity. Click the dropdown in the top right and select Edit. Change Stage to Closed Won. Update the Amount to be greater than $100,000. Notice the OrderID field is empty. Click Save.
  8. Go back to your flow. If you can see the green lines below the cards flowing through all the way until the last connector, your flow has been triggered and you should have received a text message with the order details.
  9. Switch back to Salesforce and refresh the opportunity page. You should see the OrderID populated with the value from the SMS.

Congratulations! You made it to the end. The integration flow that you created will now get triggered every time an NTO sales rep closes an opportunity within Salesforce. Without any additional effort to the Sales team, your integration will automatically place orders and notify the customers via SMS. In summary, let’s quickly review the concepts you learned through this project.

  • Extracting/appending data from data sources like Salesforce, databases, APIs, and so forth
  • Creating decision tree with conditions using Choice router
  • Transforming data between different formats using the Transform component
  • Using third-party APIs using connectors like Twilio connector

This will be a great time saver for NTO’s sales staff. Similarly, you can use Anypoint Flow Designer to automate and integrate based on your company’s needs. 

We won’t check any of your setup. Click Verify Step to earn your badge.

Keep learning for
Sign up for an account to continue.
What’s in it for you?
  • 1 in 4 land a new job
  • 50% receive a promotion or raise
  • 80% learn new technologies that boost their resume
  • 66% say it increases productivity
Source: Trailblazer Community Impact Survey 2019