The CreatorCon Call for Content is officially open! Get started here.

Check for attachments?

Edwin Fuller
Tera Guru

On insert or update of the form, if the field "submission_type" is "Client Change Request" I need the user to attach a document before being allowed to submit the form. Any ideas on how I can accomplish this? Examples will be great.

Thanks,

Edwin

1 ACCEPTED SOLUTION

I believe hasAttachmensts() is not allowed in scope applications. Then remove the conditions and use this in the script



var gr= new GlideRecord('sys_attachment');


gr.addQuery('table_sys_id',current.getValue('sys_id'));


gr.query();


if(!gr.hasNext()){


gs.addErrorMessage("No attachments");


current.setAbortAction(true);


}


View solution in original post

6 REPLIES 6

It worked, but I'm also reeving   an "Invalid Insert" error as well, is that suppose to happen?



and thanks so much!!



find_real_file.png


Abhinay Erra
Giga Sage

Yes. This is caused by current.setAbortAction(true) statement.