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
|
Enterprise
|
Above $50k
|
Small Business
|
All others
|
Retail
|
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.
- Click Salesforce to Twilio Connector under the Project sidebar to navigate back to your flow.
- Click the
between the Salesforce Connector card and the Transform card to add a new component.
- In Search, enter
Set Variable
, then select Set Variable. - For the Variable Name, enter
OppDetails
. - 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:
- Now, add the Choice router for getting product information. Click the
between the Set Variable and Transform cards.
- Enter
Choice
in Search, then select Choice card. - Click the
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
- 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.
- 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
- Click Test, then Save.
- Paste this query in the SQL text area:
select * from products where category = "Enterprise" and inventory > 1 limit 1
- Close the Database card.
- 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.) - 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 } ]
- Your flow should look something like this:
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.