The Now Platform® Washington DC release is live. Watch now!
12-11-2017 09:18 AM
We have a onsubmit script for CMS that worked fine but this is not working on Service Portal.
function onSubmit() {
//Type appropriate comment here, and begin script below
var sys_id=gel('sysparm_item_guid').value;
var gr = new GlideRecord("sys_attachment");
gr.addQuery("table_name","sc_cart_item");
gr.addQuery("table_sys_id",sys_id);
gr.query();
if (!gr.next()) {
alert("Please attach the 'Desktop Software Security Review' filled out form before submitting this request");
return false;
}
}
Am i missing something that can cause it not to work on Service Portal
12-11-2017 02:19 PM
hi Matt,
i believe this is what you are looking for.
Require attachment for catalog item in Service Portal
Hope this helps.
12-11-2017 02:51 PM
Hi,
You can review the below two blogs:
Service Portal: Require attachments — ServiceNow Elite
Require Attachments - ServicePortal.io
Hope this helps.Mark the answer as correct/helpful based on impact.
Regards,
Shloke
05-28-2019 03:29 AM
Anyone who's wondering why this code is not working in current time then let me tell you that there is a new option brought by SN from London release called Isolate script. This option is brought by SN to discourage use of DOM in SN scripting.
05-28-2019 03:32 AM
With Madrid, an out-of-the-box checkbox has been introduced to make Attachments mandatory / hidden on the Service Portal.
Check out an article I wrote about this:
Service Portal Catalog Items: Hide Attachment / Mandatory Attachment [Madrid]
Kind regards,
Mark
---
Kind regards,
Mark Roethof
Freelance ServiceNow Consultant
9x ServiceNow Community/Developer MVP
---
350+ Articles, Blogs, Videos, Podcasts, Share projects - Experiences from the field