Virtual Agent Decision box not working

Meghant Rai
Kilo Guru

Hi All,

 

I have a requirement where I have to show outages on the Virtual agent greeting message:

There's a checkbox field(u_portal_outages) in Core_Company table if checked then the outages from this company can be seen in portal.

I have to check the company of the login user and if the company of logged in user have this field as checked then I have to proceed further to glide the outage table to fetch more details about the outage.

 

Now I am not able to check this field if it's true or not in my virtual agent topic somehow.

 

var company= vaInputs.check_company_of_logged_in_user; (Fetching the sys id of the company of the logged in user)
var gr= new GlideRecord('core_company');
var value='';
gr.addQuery('sys_id',company);
gs.log('Virtual Agent', company);
gr.query();

if(gr.next())
 
{
value= gr.u_portal_outages;
}
vaVars.outage_check= value;
return vaVars.outage_check;
 
Then in the condition field of the decision box I am checking if outage check variable is true or not

 

5 REPLIES 5

Mark Roethof
Tera Patron
Tera Patron

Hi there,

 

Where are you using this script? In a Script Action? Or is this the script on both the transitions from the decision?

 

Did you also debug if this gives the values you would expect?
vaInputs.check_company_of_logged_in_user

 

Kind regards,
Mark

 

Kind regards,

 

Mark Roethof

Independent ServiceNow Consultant

10x ServiceNow MVP

---

 

~444 Articles, Blogs, Videos, Podcasts, Share projects - Experiences from the field

LinkedIn

In Script Action.

MeghantRai_0-1689167362475.png

Not really sure how to achieve it

So how do the transitions look like?

 

Kind regards,
Mark

 

Kind regards,

 

Mark Roethof

Independent ServiceNow Consultant

10x ServiceNow MVP

---

 

~444 Articles, Blogs, Videos, Podcasts, Share projects - Experiences from the field

LinkedIn

the compiler always go to Either true or either false depending upon the changes I make in the scripts.  It's not dynamic