I've created an ACL on sys_attachment table to restrict the attachment to specific users but it is affecting the attachments on relative record producer too

gubbala12345
Kilo Explorer

The following is the small script I've written on sys_attachment table to restrict the read-access of those attachments for a specific table to the assigned person but the record producer that is creating records on the table (u_capital_workflow'), is being affected as it is stopping the users to attach an attachment such as it is not showing as no attachments even after they attached something.

if(current.table_name == 'u_capital_workflow'){

  var gr = new GlideRecord("sn_sm_finance_task");

  gr.addQuery("parent", current.table_sys_id);

  gr.query();

  if (gr.next()) {

  if(gr.assigned_to == gs.getUserID()){

  answer = true;}

  else{

  answer = false;}

  }

  }

else{

  answer = true;

}

4 REPLIES 4

Chuck Tomasi
Tera Patron

Have you looked at a client script on the form using g_form.disableAttachments() instead of the ACL? That would leave it intact for the record producer, but disable adding/removing attachments from the form.



GlideForm (g form) - ServiceNow Wiki


Yeah but that just disables the users to attach new attachments   but wouldn't restrict the users to read the existing attachments right?


Have you thought about using a condition like:



if (current.isNewRecord()...



in your ACL? That may help determine whether you are creating a new record (from a record producer) or editing an existing one.


This seems a reasonable idea, I'll have to try this. Thank you so much.