Chatbot Help Portal

How can we help you?

 Print
Entity reference field
You may face the situation in which some Items of an Entity should be linked to an Item of another Entity. Thus, these 2 Entities can be considered as having a relationship. The example below will let you understand this relationship:

Let's assume that we have a chatbot for a laptop store. This store sells laptops from providers such as Dell, Apple, Asus, etc. Each provider owns different product lines of laptops. To be more precise, Apple has Macbook Air 2017, Macbook Air 2018, Macbook Pro 2018, etc.

Create CMS Entity Reference

We have 2 Entities which are:
  • Provider (illustrating the list of providers: (Dell, Apple, Asus) includes the Name field which displays the name of a provider.
  • Laptop (illustrating the list of laptops: Macbook Air 2017, Macbook Air 2018, Macbook Pro 2018, Dell XPS 13) includes Name, Provider. Each item of the Laptop entity belongs to an item of Provider entity:
  • Name will display the name of a Laptop. (default field)
  • Provider will show laptop providers. The data type of this field is Entities Reference and this field is referred to as the Provider entity. The reason is that each item of the Laptop entity belongs to an item of Provider. Besides, you can also add the field of Photo, Price to give detailed information for the product.


Select the item for association from within the Item Detail form like the picture below once you have set up the Reference relationship between any 2 Entities:



Understanding the relationship between Entities and constructing these Entities smartly will make your bot:
  • Clear, clean and time-saving because fewer blocks are used in Flow Editor
  • More flexible: Blocks are automatically updated once you make any change to the data in these Entities

Use CMS Reference in Block

This part is to make 2 objectives Provider and Laptop which are mentioned in the section above appear in the block, we need to:
  • Display items of an Entity based on the user's response to a referred Entity (Display laptops based on the user's choice of provider)
  • Display automatically Items that are added into Entities latterly

Follow these step to accomplish the use of CMS Reference in Block:

1. Select CMS for Quick Reply to make a list of items of the Provider entity

2. Save the response for this block under the suitable name of a variable (eg: saved as selected_provider). When the user chooses one of the Quick Reply buttons, an item of Provider entity which is corresponding to will be saved.

3. Utilize the variable to filter appropriate items based on the Provider field (a field which is referred to the Provider entity) to use Laptop entity



4. Use Vertical List Block to list items from the Laptop entity.

5. Filter suitable Laptop items based on the response for Text block (Provider field of these items is the response from above Text block)


Result: When you select Apple, a laptop product line of this brand will be shown. Similarly, if you select Dell, only Dell laptops are listed.
Was this article helpful?
Chatbot Help Portal | 2024