How to make ‘attach file’ as mandatory when claim damage request is selected as ‘Yes’.

Talari Balateja
Tera Expert

Hi,

 

In record producer, I want to make ‘attach file’ as mandatory when claim damage request is selected as ‘Yes’.

 

Regards,

Sanju

5 REPLIES 5

Ravi Gaurav
Giga Sage
Giga Sage

Hi @Talari Balateja 

 

You can write a onSubmit catalog Client Script like below :-

function onSubmit() {
if ((g_form.getValue('<variable_name>') == 'yes') &&
this.document.getElementsByClassName('get-attachment').length == 0) {

g_form.addErrorMessage(getMessage('Attachment is mandatory when Claim Damage Request is Yes.'));
return false; // Prevent form submission
}
}

 

 

--------------------------------------------------------------------------------------------------------------------------


If you found my response helpful, I would greatly appreciate it if you could mark it as "Accepted Solution" and "Helpful."
Your support not only benefits the community but also encourages me to continue assisting. Thank you so much!

Thanks and Regards
Ravi Gaurav | ServiceNow MVP 2025,2024 | ServiceNow Practice Lead | Solution Architect
CGI
M.Tech in Data Science & AI

 YouTube: https://www.youtube.com/@learnservicenowwithravi
 LinkedIn: https://www.linkedin.com/in/ravi-gaurav-a67542aa/