Get value of dot walking field in script include

imhicham
Tera Contributor

Hi all, i have a use case to display this value ( "FR" ***** varibale name = "iso" **** table = "core_country" ) it depends a variable on the catalog called "u_technical_ad_site" on the same table "cmn_location" with the variable "u_country_ref " : 

 

imhicham_0-1728490993777.png

 

in a variable "single line text" called "ADDinfo" : 

imhicham_1-1728491414882.png

 

how can i do that with a script include & client script ?

7 REPLIES 7

Sandeep Rajput
Tera Patron
Tera Patron

@imhicham You don't need to write a script to achieve this. You can simply use the Auto Populate feature available on the Variable form.

 

For more information please refer to https://www.youtube.com/watch?v=IMLdnF7ufOg

 

https://www.servicenow.com/community/developer-articles/auto-populate-reference-data-in-service-cata...

 

Hope this helps.

Technical Consultant Manan Bhatt walks us through how to Auto-populate Variables on Catalog Item in the ServiceNow Utah Release. You can auto-populate the catalog item variables using an onchange client script. Learn more: ...

the problem i have , i need to put three value on this variable not one, for the others is fine with script

PraveenK1149237
Tera Expert

@imhicham  So you just want to show the iso field value when a country is selected you can use a on change client script u_country_ref  and then do AJAX call to client call able script include. 
set the value you get in the response to your desired variable.
In case you need to show multiple value to your variable from different dot walk what you can do is this before using g_form.setValue() in the client script. You can do this
var temp = g_form.getValue("your variable name");
g_form.setValue("your variable name", tamp+response);

By this way you will be able to append value without overriding the previous value in the variable
For GlidAJAX help refer to this link https://www.servicenow.com/community/developer-articles/glideajax-example-cheat-sheet/ta-p/2312430

Ho...