How to extract the Entity Value from the Virtual Agent Search Text

jpeterson2
Giga Contributor

Does anyone know how to extract the below value in the Virtual Agent Designer? I found that I can use "vaSystem.getSearchText()" to get the entire search text which in this example was "What is the status of INC0462117" and then I could write a script to parse out the ticket number but does anyone know if there's a way to grab it similar to how I grabbed the search text? For example, if there was a vaSystem.getEntityValue() it would return INC0462117.

 

find_real_file.png

1 ACCEPTED SOLUTION

I get what you're saying and agreed that does sound like a good, user-friendly design.

To give you a slightly different perspective, here's what our Ticket Status topic does: we have Ticket as a pattern entity and at the top of the topic, we do a simple regex check on the user's utterance - vaSystem.getSearchText().match(/(ritm|inc|ims)[0-9]{7,12}/i (note: this regex exactly matches the entity's regex) -  and if there's no match, we ask the user how they'd like to search for a ticket: search by number, show all open tickets, show all closed tickets, etc. And if there is a match, then we bypass that first question and assume they want to search by number, in which case the topic points to the text input ("Enter your ticket number") which is mapped to the entity, skip confirmation if matched, and voila - that's it, the user is shown the status of that ticket without having to type it in or provide any other input. Plus it works for users that know their ticket number but don't input it as an utterance.

If there was a more ootb way to get the entity in the topic, I would certainly prefer to use it, but luckily for now, ticket number being a pattern entity makes it easy enough to run the same regex on the utterance.

And so my recommendation would be to not overthink the entity extraction part - use the ootb entity input mapping - and do something similar to what I did: regex at the beginning of the topic to bypass the normal flow for users that provided a ticket number and send them to a text input mapped to your ticket entity and check the "Enable NLU at Input Node" and "Skip confirmation for recognized entity" boxes. If you keep your topic design as described, it will be as if that text input doesn't exist - no user will ever see it because the only time it'll be reached is when there's an entity match and it'll just auto-fill for the user.

 

View solution in original post

11 REPLIES 11

rossida
Tera Contributor

Hi Chris,

      I have an issue related to this that I need your help.  My entity: "Employee" has multiple values and I can't figure out how to get them all or  at least one?  I have 10 employee with the name "John Smith".  If I execute my VA and ask: "who does Jane Smith work for" the entity is captured in the variable: vaInputs.utterance_employee and I am able to use this to get the sys_user record.  However, when the entity contains several values, I cannot manipulate the variable to get any entity value? 

Victor Chen
ServiceNow Employee
ServiceNow Employee

The entity value and what it's mapped to can be found in open_nlu_predict_entity_feedback. You may have to configure layout to bring in the "value" and "mapped to" fields. 

Edit the layout of the VA Designer? Can you elaborate?

They mean the layout of the form.

By default, that form only shows two fields, so if you want to see more on each individual record, you need to add them to the view. Or otherwise just use the list view

find_real_file.png

find_real_file.png

You can see in that example highlighted, the user simply typed in a RITM into VA which mapped to my Ticket entity, which triggered the Check Ticket Status topic (you can't tell that explicitly here), and in that topic, the entity was extracted and mapped to the "enterrecord" text input, which like I described above, is skipped because it recognized the entity with a 100% match (since it matched the regex pattern).
Tbh I'm not sure why the one below it didn't get mapped to the same input though... hm...

Loudigi
Kilo Sage

As of the San Diego release, you can solve this without writing any code and using the OOB "Check IT Ticket Status" Topic that comes with the ITSM Virtual Agent Conversations pack. When you view the utterances list, you can see that some of them use ticket numbers like INC1234567. These utterances come with pattern entities associated with them. VA will understand what INC or REQ is.

 

NLU_Intent_utter.png

 

The only thing missing is updating the nodes in the flow to make use of these entities.

  1. For Incident or Requested Item node, set the Associated Entity to tasktype.
  2. For the Get Record node, set it to ticketnumber.

Set_node1.png

 

 

Set_node2.png

 

 

The result...

Demo_final_result.png