Join the #BuildWithBuildAgent Challenge! Get recognized, earn exclusive swag, and inspire the ServiceNow Community with what you can build using Build Agent.  Join the Challenge.

Unable to fetch the reference field value in catalog client script

janindiadoc_1
Tera Expert

I have a record producer with three reference variables say A,B and C. B and C fields are populated based on value of A.  I'm using the new "Auto Populate" feature where I have put the dependent question as A for B and C.

Created a client script "on change" of variable A.

var a = g_form.getValue("a");
var b = g_form.getValue("b");
var c = g_form.getValue("c");

Alert shows the value for "A" selected, but not B and C (coming as empty) for the first time.
Second time when I change the reference field value for "A" the first selections sys id is coming for B and C.

I want to have the values for B and C as soon as I change A. I'm not sure how to fix this issue. Please help if anyone has faced this issue before and have a solution.

Thanks

6 REPLIES 6

Sohail Khilji
Kilo Patron

Hi @janindiadoc_1 ,

 

I belive you are having the issue in your client script, Can you please share the script that your using so that i can lookinto ...

 


☑️ Please mark responses as HELPFUL or ACCEPT SOLUTION to assist future users in finding the right solution....

LinkedIn - Lets Connect

Kapil_1409_0-1707032110770.png

Kapil_1409_1-1707032192719.png

 

I am trying to update catalog item variable based on the variable of MRVS. Hence is the script for this. But here first time i select it shows empty but if I select for the second time it shows. The variable 'unit_price' is auto populating based on other variable.