How do I make an attachment mandatory based on condition in Record Producer?
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
12-03-2023 10:56 PM
Hi Team,
How would I make an attachment mandatory in Record Producer based on Multiple choice variable? I have a Multiple choice type variable which has two options like Single and Mass. How would I make an attachment mandatory when value Mass is selected?
Thanks
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
12-03-2023 11:02 PM - edited 12-03-2023 11:04 PM
Hi @Sid_Takali
Please refer the below threads which has detailed explanation along with example on how to achieve your requirement:
You can reference any of these links and check for your variable condition as below using an On Change Script if you want to make it mandate based on selection of the variable value
https://support.servicenow.com/kb?id=kb_article_view&sysparm_article=KB0743672
Regards,
Shloke
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
12-03-2023 11:04 PM
Before running this script, Make an Isolate script: False on client script / catalog client script.
Add your condition before first if
1. This script will run UI Types: Native and Service Portal
function onSubmit() {
if(this.document.getElementsByClassName('get-attachment').length == 0) {
alert(''You must add an attachment before submitting this request.');
return false;
}
}
Mark my answer correct if it worked
Thanks and Regards
Prashant Ahire