- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎05-08-2017 03:29 AM
Hi,
I have a catalog Item in which i have used a common variable set which has on load catalog client script at variable set level (Which auto populates the default value for "Requested For"). I have created a on load catalog client script at catalog item level to make "Requested For" as blank, However it is getting over ride by the catalog client script at variable set level. I have tried by changing the order of the catalog client scripts still it's not working
Thanks in advance
Solved! Go to Solution.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎05-08-2017 05:39 AM
Hi Harita,
You did not required 2 scripts for that. So your maintaining variable auto population in variable set, in that only you can add this line of code
if (g_form.getUniqueValue() == 'your catalog item sys_id'){// means you don not need to set the values of item
g_form.setValue('first_name','');
g_form.setValue('last_name','');
g_form.setValue('company','');
}
else{
your existing code to populate the records.
}
Try this way and you can delete or inactive the script on catalog item level.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎05-08-2017 03:40 AM
Can i know what is the requirement exactly.
First variable set script will execute and then item level scripts will execute in servicenow.
You can use "default value" concept, instead of going with script, like placing of javascript:gs.getUserID()
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎05-08-2017 05:32 AM
For "Requested For" default value we are using, javascript:gs.getUserID(). Based on this value we are populateing variables like First Name, Last name, Company of the user. That script was common and it was running at Variable Set Level. For this particular Catalog Item I want to blank out the details of the user (First Name, Last name, Company of the user), this script was written at Catalog Item Level
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎05-08-2017 05:39 AM
Hi Harita,
You did not required 2 scripts for that. So your maintaining variable auto population in variable set, in that only you can add this line of code
if (g_form.getUniqueValue() == 'your catalog item sys_id'){// means you don not need to set the values of item
g_form.setValue('first_name','');
g_form.setValue('last_name','');
g_form.setValue('company','');
}
else{
your existing code to populate the records.
}
Try this way and you can delete or inactive the script on catalog item level.