Write operation against 'sys_attachment' from scope 'sn_customerservice' has been refused due to the

Hafsa1
Mega Sage

I have insert BR written to add attachment from sys_attachmnet table to csm table. Attachment getting added when raising from admin user, but when raising from end user/ITIL user then getting below error:-

 

Write operation against 'sys_attachment' from scope 'sn_customerservice' has been refused due to the table's cross-scope access policy

 

Already created scope policy and it is working only for admins

1 ACCEPTED SOLUTION

@Hafsa1 

this line in record producer script will do the job in both native and portal.

Working solution here, give your correct variable name

new global.VariableUtil().copyAttachment(producer.my_file,'sn_customerservice_case', current.sys_id);

 

AnkurBawiskar_0-1737549653011.png

 

 

Output:

copy attachment variable to target record.gif

If my response helped please mark it correct and close the thread so that it benefits future readers.

Regards,
Ankur
Certified Technical Architect  ||  9x ServiceNow MVP  ||  ServiceNow Community Leader

View solution in original post

11 REPLIES 11

Ankur Bawiskar
Tera Patron
Tera Patron

@Hafsa1 

cross scope doesn't differentiate between admin or non-admins

if it's working with admin then it should work with non-admins as well

share your BR script and what's your actual requirement?

If my response helped please mark it correct and close the thread so that it benefits future readers.

Regards,
Ankur
Certified Technical Architect  ||  9x ServiceNow MVP  ||  ServiceNow Community Leader

After insert BR written on "sn_customerservice_north_america_procurement" table
 
var gr = new GlideRecord("sys_attachment");
    //gr.addQuery("table_name", "ZZ_YYsn_customerservice_north_america_procurement");
    gr.addQuery("table_sys_id", current.sys_id);
    gr.query();
    while(gr.next()) {
        gr.table_name = "sn_customerservice_north_america_procurement";
        gr.update();
        //new global.VariableUtil().copyAttachment(gr.sys_id, "sn_customerservice_north_america_procurement", current.sys_id);
    }

Hafsa1
Mega Sage

created below scoped but still getting error from admin as well

Hafsa1_0-1737492612506.png

 

@Hafsa1 

what's your actual requirement?

Please share complete details.

If my response helped please mark it correct and close the thread so that it benefits future readers.

Regards,
Ankur
Certified Technical Architect  ||  9x ServiceNow MVP  ||  ServiceNow Community Leader