The CreatorCon Call for Content is officially open! Get started here.

How do I make an attachment mandatory based on condition in Record Producer?

Sid_Takali
Kilo Patron

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? 

SiddharamTakali_0-1701673184241.pngSiddharamTakali_1-1701673209855.png

 

 

Thanks

2 REPLIES 2

shloke04
Kilo Patron

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://www.servicenow.com/community/developer-articles/service-portal-make-attachments-mandatory-on...

 

https://www.servicenow.com/community/now-platform-blog/making-attachments-mandatory-in-sp-the-ultima...

 

https://www.servicenow.com/community/developer-articles/possible-ways-for-making-an-attachment-manda...

 

https://support.servicenow.com/kb?id=kb_article_view&sysparm_article=KB0743672

 

Hope this helps. Please mark the answer as correct/helpful based on impact.

Regards,
Shloke

Prashant Ahire
Kilo Sage

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