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.

Double dot walking is not working in catalog client script

Brijmohan
Tera Contributor

I am stuck on one issue in catalog client script. I have one variable that referring table A, and in table A there is another reference filed that referring table B, so I want to Auto populate table B data in my other variable. I have wrote one catalog client script but not working. For example i have below code--

g_form.getReference('variable_name', function (DataAsset)) {

    g_form.setValue('form_field_name', DataAsset.a_table_field_name.b_talbe_field_name);

}

When I have checked with alert function, it giving me undefined value.

Please help on this. Thanks in advance!

1 ACCEPTED SOLUTION

RaghavSh
Mega Patron

Double dot walk does not work in client script.

Also getReference is not best practise, use glide ajax, you can do any level  dot walk in script include as it is a server side script.

Please mark this helpful/correct accordingly.

 


Raghav
MVP 2023
LinkedIn

View solution in original post

4 REPLIES 4

Charles Louis1
Giga Expert

Hi,

In Client Script you can just do a single dot walking to do a multiple dot walking you need to write a GlideAjax and Script Include.

Please go through the link for more info : https://community.servicenow.com/community?id=community_question&sys_id=83a904551b838050fff162c4bd4b...

 

Please Mark it as correct if its helpful.

Voona Rohila
Mega Patron
Mega Patron

Hi Brijmohan

Double dot-walk will not work in client scripts.

you should use glideajax and get the value

Adding few links below , you can try and let us know if you're stuck.

.https://community.servicenow.com/community?id=community_question&sys_id=0bfea820db387010fb1e0b55ca96...

https://developer.servicenow.com/print_page.do?release=quebec&category=null&identifier=c_GlideAjaxAP...


Mark it helpful if this helps you to understand. Accept solution if this give you the answer you're looking for
Kind Regards,
Rohila V
2022-25 ServiceNow Community MVP

RaghavSh
Mega Patron

Double dot walk does not work in client script.

Also getReference is not best practise, use glide ajax, you can do any level  dot walk in script include as it is a server side script.

Please mark this helpful/correct accordingly.

 


Raghav
MVP 2023
LinkedIn

Please mark the relevant answer correct to close the thread


Raghav
MVP 2023
LinkedIn