Copy Attachment from attachment type variable to Data Source using Client callable script include
Options
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
yesterday
I have a attachment variable on the catalog form and I created a on change catalog client script that calls Script Include to Copy the attachment from the variable to data source in script include.
Tried multiple script and it doesn't do anything
var attachmentSysId = this.getParameter('sysparm_attachment_id');
var dataSourceSysId = 'a73774132f4c8710b456202bcfa4e3cc';
var gsa = new GlideSysAttachment();
var grAtt = new GlideRecord('sys_attachment');
grAtt.addQuery('table_sys_id', dataSourceSysId);
grAtt.query();
while (grAtt.next()) {
grAtt.deleteRecord();
}
//Copy New attachment to Data source and transfor it
var grAttachment = new GlideRecord('sys_attachment');
if (grAttachment.get(attachmentSysId)) {
var grDataSource = new GlideRecord("sys_data_source");
if (grDataSource.get(dataSourceSysId)) {
//Copy Attachment to Data Source
// gsa.copy(grAttachment.table_name, grAttachment.table_sys_id, 'sys_data_source', dataSourceSysId);
//gsa.copy('ZZ_YYsc_cart_item', attachmentSysId, 'sys_data_source', dataSourceSysId);
//gsa.copy('sys_attachment',attachmentSysId, 'sys_data_source',dataSourceSysId);
0 REPLIES 0
