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:
- Click the
sign before the transform card that formats data for Twilio and add a Set Variable module with these details.
- For Name, enter
- For the value, click the f(x) button and enter
- For Name, enter
- Now on click the to the right side of Twilio card and add a new transform card. Open the transform card.
- Collapse the payload in the Input section (left side). You’ll see OrderDetails and OppDetails under vars section.
- Click the next to OrderDetails, and set the type to Order Tracking.
- Click the next to OppDetails, and set the type to Salesforce Opportunity.
- Close the card and add a new Salesforce connector to your flow. Select Update as the operation.
- Click from the top right of the box and select Refresh. This causes DataSense to fetch data from Salesforce.
- 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.
- Drag the
Idfrom OppDetails in the Input to the
Idon the Output.
- Drag the
OrderIDfrom Input to the
OrderNumber__con 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.
- 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.
- Verify you’ve entered your phone number on the To field in the Transform card that transforms data for the Twilio connector.
- 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.
- Log in to your Salesforce instance using the credentials you used in the connector. Click to open the App Launcher, and select Sales.
- Click Opportunities and change the view to All Opportunities using the dropdown.
- Find an opportunity that does not have the Closed Won stage.
- 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.
- 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.
- 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.