How to avoid use of sys_id in Client script
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎02-25-2015 02:45 AM
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 ?
- Labels:
-
Integrations
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎02-25-2015 10:01 PM
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.

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎02-25-2015 10:07 PM
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 ?
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎02-25-2015 10:44 PM
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.

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎02-25-2015 10:50 PM
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.do?sys_id=f0c0fd142fa2b100217b588b91a18911&sysparm_view=
URL : https://demo023.service-now.com/login.do
Username and password : admin
Create a new incident and check
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎02-25-2015 11:13 PM
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.