GlideSysAttachment.copy function
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
03-06-2018 01:35 PM
I have a requirement to create a facilities request from within a workflow on a catalog item. Part of this is to have the attachments from the RITM be copied on to the facilities request that is created.
I have used the glidesysattachment.copy function, one that we use on a UI action to do something similar and it wont copy over the attachments. Are attachments from RITMS from an order guide on a different table than the sc_req_item table? Not sure where I am going wrong here.
Below is my script, this is via a run script on the workflow on the sc_req_item table. Any help is greatly appreciated.
var fr = new GlideRecord("facilities_request");
fr.opened_for = current.reques.requested_for.getDisplayValue();
fr.assignment_group.setDisplayValue('Corporate Security');
fr.contact_type = 'self-service';
fr.category = 'security';
fr.requested_due_by = current.variables.requested_due_by;
fr.short_description = 'ID Badge (New) - Onboarding';
fr.description = 'ID Badge (New or Modify access) - Onboarding for ' + current.request.requested_for.getDisplayValue() + '\n' + current.variables.description;
u_confidential_record = false;
fr.work_notes = '\nTYPE: ' + current.variables.type.getDisplayValue()+
'\nREQUESTED FOR: ' + current.request.requested_for.getDisplayValue()+
'\nREQUESTED FOR MANAGER: ' + current.request.requested_for.manager.getDisplayValue()+
'\nSUBMITTED BY: ' + current.opened_by.getDisplayValue()+
'\nPRIORITY: ' + current.variables.priority.getDisplayValue()+
'\nREQUEST DUE BY: ' + current.variables.requested_due_by;
var sysID = fr.insert();
//Pull attachments from RITM to FCR
GlideSysAttachment.copy('sc_req_item', current.sys_id, 'facilities_request', sysID);
- Labels:
-
Scripting and Coding

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
03-08-2018 12:47 AM
This works in workflow.
Thanks,
Ashutosh Munot

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
03-10-2018 10:29 AM
Hi,
Did this worked?
Thanks,
Ashutosh Munot