How to avoid use of sys_id in Client script

pradeepgupta
Giga Expert

Hi,

What is the best practice to avoid use of sys_id in client script.

E.g. onChange of category wanted to set assignment group to ABC.

if(category=='Test')

{

g_form.setValue('assignment_group', '196589360f6471008fdcfa6ce1050e3a(sys_id of ABC)', 'ABC');

}

How to avoid use of sys_id here, as we can not use gs.getProperty in client script? Any idea ?

12 REPLIES 12

If I want to display assignment group by scratchpad of business rule in client script, It is not working when the incident is new as business rule(Display) runs on submit of incident and before submit of incident scratchpad value is undefined.


Display business rule is different .. It runs when the page is requested at the server end .. It does not run on submit and will run on new records as well . Are you sure you are not missing anything here ?


For new incident scratchpad value which I received in client script is undefined, however after incident is created I am able to get value of scratchpad in client script.


You are missing something here.. Some issue with your code maybe ..



Access this and verify for yourself .. I am setting the assignment group through scratchpad



https://demo023.service-now.com/sys_script_client.do?sys_id=5601ea5f0a0a0b4b0055644e71c28968&sysparm...


https://demo023.service-now.com/sys_script.do?sys_id=f0c0fd142fa2b100217b588b91a18911&sysparm_view=







Thanks Kalaiarasan P I checked it in demo023, it is working fine , however when I applied same in my instance, I am getting scratchpad value as undefined in client script. Is this due to MSP domain separated environment because we are using   domain separated environment.