- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
06-11-2019 03:04 PM
I know this question must be pretty common, but I am not being able to get around it. I'm trying to make users attach a document on the initial form for a record producer and I found this on the community: https://community.servicenow.com/community?id=community_question&sys_id=ec764fe1db1cdbc01dcaf3231f96...
I can't make it work (of course, I placed my custom table instead of the one displayed on the code). My custom table is: u_procurement_request_pp
Solved! Go to Solution.
- Labels:
-
Best Practices
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
06-12-2019 09:32 PM
Actually, the post I mentioned works and most of the solutions suggested work. The reason why I was having trouble was because there is a hidden field on the client script from that should be disabled. That field is: "isolate script"
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
06-11-2019 10:08 PM
Correct...this is for a record producer, however, the out-of-the-box checkbox you recommend is only for catalog items
The script on your article failed to work:
function onSubmit() {
if(this.document.getElementsByClassName('get-attachment').length == 0) {
g_form.addErrorMessage(getMessage('mandatory_attachment')); return false;
}
}

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
06-11-2019 10:11 PM
You are aware a Record Producer is a Catalog Item? Only extended?
Or are you on Pre-Madrid and therefor looking for Catalog Client Scripting?
The scripting mentioned in the article is tested and proven to work.
Can you share a screenshot of your Catalog Client Script? Can you also confirm it is actually running and not something else is wrong (for example the UI type: All / Desktop / Mobile/Service Portal)?
Are you running this Record Producer on the Platform UI or on the Service Portal?
Kind regards,
Mark
Kind regards,
Mark Roethof
Independent ServiceNow Consultant
10x ServiceNow MVP
---
~444 Articles, Blogs, Videos, Podcasts, Share projects - Experiences from the field
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
06-11-2019 10:20 PM
Yes, I'm aware it is extended, I just couldn't find the out of the box "mandatory attachment" checkbox...I am assuming it due to my instance version which is London. Also thee script on your article doesn't even let me submit the form...it sort of crashes
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
06-11-2019 10:20 PM
Hi,
I did via DOM Manipulation in an onSubmit catalog client script, it worked but may break in future.
But in Madrid, it seems to have a checkbox for mandatory attachments on catalog item. Once Upgraded to Madrid, need to change the piece of code.
WorkAround :
if (this.document.getElementsByClassName('get-attachment').length == 0)
{
alert('Please attach a file before submit');
return false;
}
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
06-12-2019 10:20 AM
This doesn't work, it doesn't even let me submit the form and doesn't prompt the alert.