Time Estimate

Use Connectors to Get Product Information

NTO has different SKUs (stock keeping units) for its enterprise customers, small business customers, and retail customers. This means, you have to select what product to associate to your opportunity based on the total amount of the deal. This table explains how products are segmented.

Deal Size (Opportunity Amount)
Product Category
Above $100k
Above $50k
Small Business
All others

You use the choice router component to achieve this branching if-else logic. But first, you need to store the opportunity data you get from Salesforce into a variable. Start by storing the opportunity details and creating the branching logic. 

  1. Click Salesforce to Twilio Connector under the Project sidebar to navigate back to your flow.
  2. Click the right arrow between the Salesforce Connector card and the Transform card to add a new component.
  3. In Search, enter Set Variable, then select Set Variable.
  4. For the Variable Name, enter OppDetails.
  5. For the value, click the f(x) button to enable script mode. Once in script mode, set the value to payload. Close the card. Your flow should look like this:
    Screenshot of a flow displaying four cards with arrows between them to signify a sequential order. The first card is a Salesforce Connector called Subscribe Topic. The second is a Set Variable card called OppDetails. The third is a Transform card called DataWeave. The fourth is a Twilio Connector card called Send Message.
  6. Now, add the Choice router for getting product information. Click the right arrow between the Set Variable and Transform cards.
  7. Enter Choice in  Search, then select Choice card.
  8. Click the card options  next to expression and select Add below. If the window closes, reopen the Choice component. You need to add two expressions for the if condition:
    • Expression: payload.Amount > 100000, Name: Enterprise
    • Expression: payload.Amount > 50000, Name: Small Business
    • The remaining go to default Shows the progress thus far. First is the Salesforce card with Subscribe Topic, second is Set Variable card, third section is the Choice router with multiple options, fourth is a Transform card, and the last card is the Twilio Connector with Send Message operation 
  9. Next, query the products database to get the product information. You’ll see two errors for the choice router. Click  the + sign on the first error, choose the Database connector, then click Select.
  10. You’ll see the error on the card. Click the link in the error bar to set up the configuration with these details.
    • Connection Type: MySQL Connection
    • Host: ntoproducts.c3w6upfzlwwe.us-west-1.rds.amazonaws.com
    • Port: 3306
    • User: mulesoft
    • Password: mulesoft
    • Database: nto_products
  11. Click Test, then Save.
  12. Paste this query in the SQL text area:
    select * from products where category = "Enterprise" and
    inventory > 1 limit 1
  13. Close the Database card.
  14. Repeat the process for the Small Business choice using this query:
    select * from products where category = "Small Business" and
    inventory > 1 limit 1
    (Note: you don’t need to set up the database configuration this time.)
  15. For the default choice, click the + sign next to Default, and select Set Payload. Click the f(x) button for script mode and add the following JSON:
      "productID": "CK111274",
      "category": "Retail",
      "SKU": "CKS0",
      "productName": "Old School Classic Kicks",
      "inventory": 9999
  16. Your flow should look something like this:

Screenshot of progress. Now the Choice router section has the Database card added for Enterprise and Small Business customers. For all other customers, the default is to set a static payload using the Set Payload variable

You’ve configured the flow to trigger on opportunity wins and also gathered product information based on the deal size. You’ve set up everything you need to call the NTO Orders API and place an order. You do that in the next step of the project.

We won’t check any of your setup. Click Verify Step to go to the next step in the project.

Keep learning for
Sign up for an account to continue.
What’s in it for you?
  • Get personalized recommendations for your career goals
  • Practice your skills with hands-on challenges and quizzes
  • Track and share your progress with employers
  • Connect to mentorship and career opportunities