How to delete attachments on data sources though transform script in scoped application
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
04-06-2017 02:29 AM
Hi All,
I'm in scoped application "abc", I have data source "abc ds" and transform map "abc tm". When I will attach the document and processed with data load, I need to delete the attachment on data source. So, I have written "on complete" transform script as below,
(function runTransformScript(source, map, log, target /*undefined onStart*/ ) {
//clean up attachment from data source once done transforming the data source
var gr = new GlideRecord('sys_data_source');
if(gr.get('sys id of data source')){
var attach = new GlideSysAttachment();
attach.deleteAll(gr);
}
})(source, map, log, target);
Let me if any one know the solution
Thanks,
sowmya
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
04-06-2017 02:39 AM
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
04-06-2017 03:05 AM
Hi,
I have given the access but still no result.
Thanks,
Sowmya
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
04-06-2017 03:23 AM
Try this in script
var gr = new GlideRecord("sys_attachment");
gr.addQuery("table_sys_id=SYS_ID_DATA_SOURCE");
gr.query();
gr.next();
gr.deleteMultiple();
Thanks
Please Hit like, Helpful or Correct depending on the impact of the response