Making Attachments Mandatory on Record Producer When a Checkbox is Checked

sravanku888
Tera Contributor

Hello ServiceNow Community,

 

I'm seeking some assistance with a specific requirement on a Record Producer.

 

Here's the scenario:

 

I have a checkbox variable on my Record Producer called "Mentioned information is correct". My goal is to make attachments  Mandatory on the Record Producer *only when this checkbox is checked (true)*.

sravanku888_0-1750340950469.png

 

 

Current Situation & Challenge:

 

I initially implemented an `onSubmit` client script. While it successfully displays a message ("Please attach attachment") if the checkbox is checked and no attachment is present, my client isn't satisfied with this functionality. They want the attachment field to become truly mandatory once the checkbox is checked.

 

Any insights, code snippets, or suggestions would be greatly appreciated!

Thanks in advance for your help!

1 ACCEPTED SOLUTION

@sravanku888 

you have only 2 options

1) continue using your client script to check mandatory attachment

OR

2) use attachment type variable and make it mandatory via UI policy based on checkbox checked

If my response helped please mark it correct and close the thread so that it benefits future readers.

Regards,
Ankur
Certified Technical Architect  ||  9x ServiceNow MVP  ||  ServiceNow Community Leader

View solution in original post

8 REPLIES 8

J Siva
Tera Sage

Hi @sravanku888 

Have you tried the "attachment" type variable?

If the end users are going to attach a single file, then you can go with "attachment" type variable.

So that you can make the variable mandatory using ui policy.

Regards,

Siva 

Ankur Bawiskar
Tera Patron
Tera Patron

@sravanku888 

If client wants to use OOTB paper-clip icon then that's the only way to stop and validate

Another way is what @J Siva mentioned if they are going to attach only 1 file then you can use attachment type variable and make it mandatory via UI policy on that checkbox variable.

If my response helped please mark it correct and close the thread so that it benefits future readers.

Regards,
Ankur
Certified Technical Architect  ||  9x ServiceNow MVP  ||  ServiceNow Community Leader

Luiz Lucena
Mega Sage

Hi @sravanku888 

 

Do you have this option on your record producer?

 

IMG_0520.jpeg

Yes