ServiceNow Virtual agent Lookup Utility

RenatoMendoza
Tera Contributor

I have been trying to create a topic that allows me to make decisions based on the user's country. For example, if the user is located in the United States, display certain information and if the user is located in Ireland, display another information. Apparently, I need to use the Lookup utility pointing to the Sys_user table but I can't define the conditions properly. Is there a way to achieve this without having to code a script?

 

Thanks in advance you all.

1 ACCEPTED SOLUTION

-O-
Kilo Patron
Kilo Patron

You could create a Subflow, using Flow Designer - that takes as input the (current) user and returns the country:

Define the inputs:

6.png

 Defined the sole action - a Flow Logic (Assign Subflow Outputs) in fact, setting the output variable "Country Name" to dot-walk "Input > User > Location > Country":

7.png

 After making sure that you configured the Subflow to be executed as the system user (vs. the current user), Save and Publish.

That's all and no code.

 

 

 

Switch to Virtual Agent Designer

Add a "Utility" of type "Action", select "Subflow" under "Invoke Flow Designer object", point to the scope and sub-flow that you have just defined, and set the sub-flow input:

8.png

 Use the data-pill picker to set the sub-flow input:

10.png

 After that you can use "Country Name" in condition builders:

9.png

No code at all.
Hopefully it helps.

View solution in original post

5 REPLIES 5

-O-
Kilo Patron
Kilo Patron

You could create a Subflow, using Flow Designer - that takes as input the (current) user and returns the country:

Define the inputs:

6.png

 Defined the sole action - a Flow Logic (Assign Subflow Outputs) in fact, setting the output variable "Country Name" to dot-walk "Input > User > Location > Country":

7.png

 After making sure that you configured the Subflow to be executed as the system user (vs. the current user), Save and Publish.

That's all and no code.

 

 

 

Switch to Virtual Agent Designer

Add a "Utility" of type "Action", select "Subflow" under "Invoke Flow Designer object", point to the scope and sub-flow that you have just defined, and set the sub-flow input:

8.png

 Use the data-pill picker to set the sub-flow input:

10.png

 After that you can use "Country Name" in condition builders:

9.png

No code at all.
Hopefully it helps.

-O-
Kilo Patron
Kilo Patron

Of course, this is just a P.o.C.

In the final product you would take into consideration and design around the possibility that the current user might not have a location field set, etc.

-O-
Kilo Patron
Kilo Patron

And because seeing is believing, here's a test:

11.png

 ðŸ™‚

Very grateful for your answer, it works perfectly! Thank you so much -0-