Anyone know the Service Portal substitue for "gel('sysparm_item_guid').value;"
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎11-14-2018 01:51 AM
I have a Catalog item that triggers an api and returns options for the user to select BUT they are specific to that Catalog request while the form is being completed ready for submission and i use "gel('sysparm_item_guid').value;" to get the unique sysID of the record and use it to attach the newly found records into a new table so they can be filtered through easily BUT this client script errors in the Service Portal
Whole script is this:
function onLoad() {
var catsysid = gel('sysparm_item_guid').value;
g_form.setValue('u_mysysid', catsysid);
}
Anyone know?
Portal error is:
(g_env) [SCRIPT:EXEC] Error while running Client Script "Show SysID": ReferenceError: gel is not defined
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎11-14-2018 02:01 AM
Hi Dave,
Please have a look in this below community post, that might help you:
What is the alternative way to use gel() in service portal..?
Please mark my answer as Correct/Helpful in case that helped you.
Thanks
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎11-14-2018 02:18 AM
Thanks Vishrut but that just gives me the sysID of the record producer, I need the sysID of the record it's going to create.
In the cms the system seems to create a record for the record producer item and gets it's own sysID, much like in incident when you select 'create new' you get a new record with it's own sysID and unique INC number.
Thats what I need, i need that new records sysID BUT does the Service Portal do that, if not i guess I'll have to start using an iFrame page
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎11-14-2018 02:19 AM
Hi Dave,
It seems you need to take widget option for this or else have this onLoad script in Global scope and try to run in service portal
Mark Correct if this solves your issue and also mark Helpful if you find my response worthy based on the impact.
Thanks
Ankur
Ankur
✨ Certified Technical Architect || ✨ 9x ServiceNow MVP || ✨ ServiceNow Community Leader
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎11-14-2018 03:11 AM
yeah thats exactly what I'm struggling with, getting it to run onload on the service portal.
I have it working fine in the Service Catalog (CMS view) but not the.
My record producer catalog item sysID is: ec0a948e4f5c170021a168d18110c724
Mobile & Portal Client Script is:
function onLoad() {
var catsysid = g_form.getUniqueValue();
g_form.setValue('u_mysysid', catsysid);
}
Here is a screen shot of my portal screen:
Desktop Client script:
function onLoad() {
var catsysid = gel('sysparm_item_guid').value;
g_form.setValue('u_mysysid', catsysid);
}
Catalogue Item screen shot of sysIds:
`