Hiding attachment for 'opened for' on hr case

rambo1
Tera Guru

Hi Team,

 

I want to hide attachments for 'opened for' user on hr case.

I created a query business rules on sys_attachment on table:

Created BR on global scope on sys_attachment table

if(gs.getSession().isInteractive()) {
hideAttachments();
}
function hideAttachments(){
         var answer = 'sys_created_by!=' + gs.getUserName();
         current.addEncodedQuery(answer);
}

This code is working fine , but I want to add conditions like table = 'sn_hr_er_case' and opened_for != gs.getUserName()

 

So, I wanted to use below code:

var gr = new GlideRecord('sn_hr_er_case');
   gr.get(current.table_sys_id);
   var answer = gr.opened_for+'!='+ gs.getUserID();
   current.addEncodedQuery(answer);
 
but I am getting cross scope issue
'Read operation on table 'sn_hr_er_case' from scope 'Global' was denied. The application 'Global' must declare a cross scope access privilege. Please contact the application admin to update their access requests.'
 What could be best solution ?
2 REPLIES 2

SanjivMeher
Kilo Patron
Kilo Patron

Did you also try g_form.disableAttachments()

 

if (g_user.hasRole('admin'))

return;

g_form.disableAttachments();


Please mark this response as correct or helpful if it assisted you with your question.

HI Sanjiv, 

I only want to hide attachment from opened for person but not to disable attachment.