How to Use Entity Values on Code Step
- Getting Started
- Bot Building
- Smart Agent Chat
- Conversation Design
-
Developer Guides
Code Step Integration Static Step Integration Shopify Integration SETU Integration Exotel Integration CIBIL integration Freshdesk KMS Integration PayU Integration Zendesk Guide Integration Twilio Integration Razorpay Integration LeadSquared Integration USU(Unymira) Integration Helo(VivaConnect) Integration Salesforce KMS Integration Stripe Integration PayPal Integration CleverTap Integration Fynd Integration HubSpot Integration Magento Integration WooCommerce Integration Microsoft Dynamics 365 Integration
- Deployment
- External Agent Tool Setup
- Analytics & Reporting
- Notifications
- Commerce Plus
- Troubleshooting Guides
- Release Notes
Using Entities on Code Editor
The information which is collected from users on the Static Step, in the form of entities, can be used on Code Step to fetch user-related information.
The connection is automatic from Static Step to Code Step i.e. whenever the user provides all the mandatory entity values, the following Code Step gets triggered. In order to use these entity values in the Code Step, we have to create new variables.
Let's take the example of fetching order details. We have an entity to save Order ID. We would use this to understand how to fetch information using entity value on Code Step -
order_id_demotrain is a regex
entity with the pattern ^[a-z]{3}\d{3}$
, this entity will accept values such as abc123
.
There is a standard JSON format in which the values are stored within an entity. To understand this format, open the Detailed Info tab on the logs sections besides the entity value which was provided to the IVA. This is found on the Test Bot as shown below -
So the Order ID is stored under the entity name order_id_demotrain
. The actual value
is stored under entity_value
. On Code Step, you can fetch the value
in this format -
order_id = entities.get("order_id_demotrain")[0].get("entity_value").get('value')