on change client script is not working for particular catalog item
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
12-24-2024 01:13 AM
Hi All,
I have written below client script but it is not working for my catalog item it is apply for all catalog item.
kindly let me know what is issue.
function onChange(control, oldValue, newValue, isLoading, isTemplate) {
if (isLoading || newValue == '') {
return;
}
var catitem = g_form.getValue("u_catalog_item");
alert(catitem);
//g_form.addInfoMessage("line 9 testing");
if(catitem == '9c9df05597661e500cb57bae2153afe2')
alert("askhr");
{
if(g_form.getValue('state') =="7")
{
g_form.setValue("close_notes", "123455");
g_form.setValue("u_knowledge_article", "no");
g_form.setValue("u_support_type", "desk");
g_form.setValue("u_resolution_code", "Solved (Permanently)");
g_form.setValue("u_via_kb_article", "no");
g_form.setValue("u_via_kb_article", "no");
}
//Type appropriate comment here, and begin script below
}
}
Thanks & Regards
KP
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
12-24-2024 01:15 AM
can you share details about the script?
it's normal client script or catalog client script?
If it's normal client script and you want it to run for specific catalog item then ensure Item field is present on RITM form and you are comparing correct catalog item sysId
If my response helped please mark it correct and close the thread so that it benefits future readers.
Ankur
✨ Certified Technical Architect || ✨ 9x ServiceNow MVP || ✨ ServiceNow Community Leader
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
12-24-2024 01:22 AM
Hi Ankur,
it is normal client script, Item name is present on RITM table
Thanks & Regards
KP
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
12-24-2024 01:54 AM
what came in alert for that cat_item sysId?
did you compare with correct sysId?
what came in alert for this?
Ankur
✨ Certified Technical Architect || ✨ 9x ServiceNow MVP || ✨ ServiceNow Community Leader
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
12-24-2024 02:22 AM
Hi Ankur,
I have tried your code but is not not working for my item. I have put current sys_id.
I have checked with other catalog item it is working over there but wrong option have been select.
as per screen snap support type is remote I have put Desk in the script also resolution notes are not populated. I want auto populate this fields for ASK_HR catalog not for any other.