Join the #BuildWithBuildAgent Challenge! Get recognized, earn exclusive swag, and inspire the ServiceNow Community with what you can build using Build Agent.  Join the Challenge.

Delete Cross Scope POlicy is not working

Swathi P
Tera Guru

Hi All,

I have a scoped application. I have a data source in the application.I am trying to delete the attachment attached to the data source through background script . I have added delete cross scope policy from my application but still my script is not working and i am unable to delete the attachment from my datasource. Please suggest.

find_real_file.png

var attach = new GlideRecord("sys_attachment");
attach.addEncodedQuery('table_nameSTARTSWITHsys_data_source^table_sys_id=c9d2bb99db9c1810776f15ce3b9619e6');
attach.query();
if(attach.next())
{
gs.info("Test the Deleting Attachments");
attach.deleteRecord();
}

5 REPLIES 5

Worked like a Charm. No need to provide "Can Delete" to sys_attachment.

Thanks