What is the alternative way to use gel() in service portal..?
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎03-20-2017 05:41 AM
Hi Team,
Can any body let me the alternative way of gel() in service portal.
i have written this onSubmit script, which works fine in CMS,
Here i need to get value of sysparm_item_guid, how do I get with out using gel() method?
I am attaching the code:
var cat_id = gel('sysparm_item_guid').value;
var sp = new GlideRecord("sys_attachment");
sp.addQuery("table_name", "sc_cart_item");
sp.addQuery("table_sys_id", cat_id);
sp.query(function(){
if (!sp.next()) {
g_form.addErrorMessage("Please attach the required SSL certificates/document");
return false;
}
});
Any help or suggestion will help me lot
Thanks,
Nithin.
- Labels:
-
Service Catalog
-
Service Portal
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎09-28-2017 01:23 AM
Take a look at this post. I've created a variable set I can add to any catalog item that requires attachments. It works in the Service Portal as well.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎09-28-2017 01:32 AM
Hi Nithin,
As a part of solution to your problems i.e. gel() and GlideAjax have your catalog onSubmit script in Global Scope and it should work fine.
Mark Correct if this solves your issue and also hit Like and 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
‎01-10-2019 12:40 PM
The above script won't work in few cases there you can use the below -
Here the item guid on cart can be obtained directly WITHOUT using gel()
var itemId = sysparm_item_guid.value;
var gr = new GlideRecord('sys_attachment');
gr.addQuery('table_name','sc_cart_item');
gr.addQuery('table_sys_id',itemId);
gr.query();
if(!gr.hasNext()){
g_form.addErrorMessage("Please attach atleast one document before submitting the form");
}
Thanks,
Saikiran Guduri (NOW)
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎09-09-2019 05:30 AM
Below Line is not working in my client Script.
Where exactly using the below code.
var itemId = sysparm_item_guid.value;
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎02-04-2020 11:01 AM
There's a typo in the code... It should be the following:
var itemId = 'sysparm_item_guid'.value;
Regards,
Josue
