Making attachment mandatory on initial record producer request form...

samuelscott
Tera Expert

 

I know this question must be pretty common, but I am not being able to get around it. I'm trying to make users attach a document on the initial form for a record producer and I found this on the community: https://community.servicenow.com/community?id=community_question&sys_id=ec764fe1db1cdbc01dcaf3231f96...

 

I can't make it work (of course, I placed my custom table instead of the one displayed on the code). My custom table is: u_procurement_request_pp

1 ACCEPTED SOLUTION

samuelscott
Tera Expert

Actually, the post I mentioned works and most of the solutions suggested work. The reason why I was having trouble was because there is a hidden field on the client script from that should be disabled. That field is: "isolate script"

View solution in original post

20 REPLIES 20

it worked just find, thanks

Ashvini Kadus1
Kilo Guru

Hi samuelscott,

 

Can you try with below link its really helpful:

https://community.servicenow.com/community?id=community_question&sys_id=dd618729db98dbc01dcaf3231f96...

 

Kindly mark as a correct answer or helpful if it helps you to find your solution.

 

 

Thank You,

Ashvini k

 

 

 

Hi Ashvini,

 

I've seen that post but there is to much fuzz about the portal and in my case, I'm not really using the portal. 

Soumita3
Tera Expert

Hi Samuel,

 

Please find the below code:

This is a before insert business rule on incident table, you can customize it according to your criteria

 

(function executeRule(current, previous /*null when async*/) {

if(!current.hasAttachments()){
gs.addInfoMessage('Attachment mandatory');
current.setAbortAction(true);
}


})(current, previous);

 

Please mark the answer as correct if it suffice your query.

 

Thanks.

This won't work since I want the user to NOT be able to submit the form if an attachment is not being attached. "Before insert" is after the user submits the form, therefore, he/she won't be stopped/prompted.