- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
03-19-2025 08:29 AM
I have a UI action with Client checked and a function in the script area. It is not working saying the function is not defined.
In On Click I have addItem(g_form.getUniqueValue());
Solved! Go to Solution.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
03-19-2025 09:01 AM
you cannot access the sysId here -> addItem(g_form.getUniqueValue());
So update it as this addItem()
Then in script do this
function addItem() {
var gdw1 = new GlideDialogWindow('acqItem');
gdw1.setTitle('Add Item');
gdw1.setWidth(200);
gdw1.setPreference('sysparm_item_id', g_form.getUniqueValue());
gdw1.render();
}
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
03-19-2025 09:01 AM
you cannot access the sysId here -> addItem(g_form.getUniqueValue());
So update it as this addItem()
Then in script do this
function addItem() {
var gdw1 = new GlideDialogWindow('acqItem');
gdw1.setTitle('Add Item');
gdw1.setWidth(200);
gdw1.setPreference('sysparm_item_id', g_form.getUniqueValue());
gdw1.render();
}
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
03-19-2025 09:07 AM
Thanks a lot. I was duplicating a very old UI action which is working the way it is.