GlideSysAttachment().copy Not copying the attachment - HR Scoped application
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎05-23-2022 08:26 AM
Hi Team,
I have created a after insert BR to insert a HR task and then copy a specific attachment from a Case to HR task .
The attachment is not getting copied to HR task. Please suggest
All the log messages are getting triggered correctly , but the attachment is not found on target record.
(function executeRule(current, previous /*null when async*/ ) {
gs.info("the BR triggerred for status");
var grCattch = new GlideRecord('sys_attachment');
grCattch.addQuery('table_name', 'sn_hr_core_case_workforce_admin');
grCattch.addQuery('table_sys_id', current.sys_id);
grCattch.addEncodedQuery('file_nameSTARTSWITHStatus Record Certificate');
grCattch.query();
if (grCattch.next()) {
var grCmnl = new GlideRecord('sn_hr_core_task');
grCmnl.initialize();
grCmnl.parent = current.sys_id;
grCmnl.assignment_group = '3506330cdbc92054e803f3551d9619b0';
grCmnl.state = '10';
grCmnl.short_description = "Validate Status Record";
grCmnl.insert();
gs.info("the record status is found " + 'attchsysid----' + grCattch.getUniqueValue() + 'attchtable---' + grCattch.getTableName() + 'tasktable----' + grCmnl.getTableName() + 'tasksysid---' + grCmnl.getUniqueValue());
new GlideSysAttachment().copy(grCattch.getTableName(), grCattch.getUniqueValue(), grCmnl.getTableName(), grCmnl.getUniqueValue());
}
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎05-24-2022 03:54 AM
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎05-24-2022 04:43 AM
yes it should work in scoped app
Try that once
Ankur
✨ Certified Technical Architect || ✨ 9x ServiceNow MVP || ✨ ServiceNow Community Leader
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎05-24-2022 02:33 AM
refer this another link
How to copy a single attachment?
Regards
Ankur
Ankur
✨ Certified Technical Architect || ✨ 9x ServiceNow MVP || ✨ ServiceNow Community Leader