I'm receiving the following error:



Function hasAttachments is not allowed in scope x_hemas_connectus2


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




  // Add your code here


if (!current.hasAttachments())


{  


gs.addErrorMessage('There is no attachment');  


current.setAbortAction(true);  


}


})(current, previous);


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

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.