How do I get the value of the entity?
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
06-27-2025 03:07 AM
I have an utterance: "Who does @employee work for?" The entity is Employee, so within my Topic flow, how do I get get the value of the entity??? Therefore, if I enter the following in the Virtual Agent:"who does John Doe work for?", I want the Topic is get just the entity's value: "John Doe". HOW can I get this??
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
06-27-2025 03:58 AM
Hello @rossida,
vaVars
object, specifically vaVars._topic_results
which provides entity values in JSON format.
vaVars
object:- In a Virtual Agent script or topic, you can access variables related to the conversation using
vaVars
. vaVars._topic_results
holds the results of the NLU processing, including identified entities.
vaVars._topic_results
provides a JSON object. You need to parse this object to extract the specific entity value you're interested in.- The structure of this JSON object will depend on how the entity was defined and identified by NLU.
(function execute() {
var locationValue = vaVars._topic_results.entities.location; // Assuming "location" is the entity name
gs.info("The location entity value is: " + locationValue);
return locationValue;
})()
If this is helpful, please hit the thumbs up button and accept the correct solution by referring to this solution in future it will be helpful to them.
Thanks & Regards,
Abbas Shaik
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
07-03-2025 06:59 AM
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
07-28-2025 06:38 AM
Thanks for the reply!
This is what I did:
- I created an Input variable called:
vaInputs.utterance_employeeValue
vaInputs.utteranceemployeeValue. This variable has the "NLU entity" set to "Employee".
- I have have a "Bot response" component that is using the "Text Response" to display this value.
I have 8 employee's with the name: "John Smith"
Virtual agent shows me 8 sys_ids but these sys_ids are NOT the USER-record sys_ids. These are the Entity's sys_ids (I believe).
How do I get and show all the entity values ?
For instance:
John A. Smith
John B. Smith
John C. Smith
John D. Smith
John E. Smith
John F. Smith
John G. Smith
John H. Smith
and have the user select which user they want??
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
07-28-2025 05:38 AM
Thanks for the reply!
This is what I did:
- I created an Input variable called: vaInputs.utterance_employeeValue. This variable has the "NLU entity" set to "Employee".
- I have have a "Bot response" component that is using the "Text Response" to display this value. Therefore, in the "Response message", I have vaInputs.utterance_employeeValue
I have 8 employee's with the name: "John Smith"
Virtual agent shows me 8 sys_ids but these sys_ids are NOT the USER-record sys_ids. These are the Entity's sys_ids (I believe).
How do I get and show all the entity values ?
For instance:
John A. Smith
John B. Smith
John C. Smith
John D. Smith
John E. Smith
John F. Smith
John G. Smith
John H. Smith
and have the user select which user they want??