Join the #BuildWithBuildAgent Challenge! Get recognized, earn exclusive swag, and inspire the ServiceNow Community with what you can build using Build Agent.  Join the Challenge.

How to Make Attachment Mandatory in Record Producer ?

BlackCoder16
Tera Contributor

I created a Record Producer and want to make attachment mandatory when service changes and before submission of the Record Producer. 

 

When I added one file from record producer then I saw it stored that file in attachment table as sn_customerservice_case in table name column instead of sc_cart_item_producer . so i did put query as

 

getAtt.addQuery('table_name', 'sn_customerservice_case'); 

 

Attachment Table Screen shot :

 

SUBHASHIS1_3-1666252750252.png

 

 

but it's not working.

 

How can I able to do it , please help me ?

 

 

Note : Application Scope : Customer Service

 

 

 

My Script Include Code :

 

SUBHASHIS1_0-1666251980452.png

 

My Client Script Code :

 

SUBHASHIS1_2-1666252300515.png

 

 

 

 

 

 

 

 

 

 

 

7 REPLIES 7

GodOfWar
Mega Guru

There's no need to code for that. You just have to set the attachment variable to mandatory.

H_9
Giga Guru

Hello,

 

Go to your record producer.

Check the following checkbox.

H_9_0-1666253841752.png

 

Please mark the answer correct if it helps.

Thanks. 🙂

BlackCoder16
Tera Contributor

Hi all, 

 

Already tried it , see

 

Record pro :

 

SUBHASHIS1_0-1666259395621.png

 

but it's not fetching that attachment .

SUBHASHIS1_1-1666259508574.png

 

but it stored in the sys_attachment table.

SUBHASHIS1_2-1666259552164.png

 

and this my business rule : 

When to run : async > insert

SUBHASHIS1_4-1666260027360.png

 

 

so i tried with oob attachment UI button and script include method . 
plz help on this ?

 

 

 

 

 

 

Hello,

You can write below code in on submit client script and first fetch value of variable because of which you want to make this as mandatory

https://www.servicenow.com/community/developer-blog/verify-mandatory-attachments-count-on-catalog-it...

Please hit like and mark my response as correct if that helps
Regards,
Musab