Restrict access to some attachments in the sys_attachment table to a group

ZieldeCrz
Kilo Explorer

Hi,

I have a before query business rule to restrict access to some incident to a group and that works great.   Now I am trying to restrict the same group to see   attachments of those incidents in the sys_attachment table. I have

I do not know how to restrict access to those attachments.

 

so far I created a before query business Rule in the sys_attachment table with no luck. Can anybody see what i am doing wrong and give me a hint what i should do.

 

findATT();

function findATT() {

  var att = new GlideRecord('sys_attachment');

  att.addQuery('table_name', 'LIKE', 'incident');

  att.query();

  while (att.next()) {

  var apre= new GlideRecord('incident');

//query   incidents assigned to this group and are in the sys_attachment table

  apre.addQuery('assignment_group', '=','726a958a40f3680003aaf8ce7eaf96c0');

  apre.addQuery('sys_id',att.table_sys_id)

  apre.query();

  while(apre.next()){

  gs.log("***************************************************");

  gs.log("found attch: " + att.table_sys_id.getDisplayValue() + " found: " + apre.number.getDisplayValue());

  //what should i code here to restrict access to those attachments

  }

  }

}

}

 

thank you for any help.

Magdalena

5 REPLIES 5

Thank you Trevor.