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

@sravanku888 

the above option will only work in portal and won't check for the checkbox condition.

Please check my above comment.

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

@Ankur Bawiskar You're right.

@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

True, but we didn't have that context.

Maybe I'm not used to have record producers outside of portals. 😁