Inbound action do not copy attachment to csm record
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎12-03-2024 06:23 PM
I need help on script when inbound email received is posted to record but the attachment is not uploaded.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎12-03-2024 09:40 PM - edited ‎12-03-2024 10:30 PM
Hi @Zuri ,
You can use below script to do so, just make some changes, like replace your target table and column details.
var sysAttach = new GlideSysAttachment();
var emailSysId = sys_email.getUniqueValue();
if (emailSysId) {
var sysEmailAttachments = sysAttach.getAttachments("sys_email", emailSysId);
while (sysEmailAttachments.next()) {
sysEmailAttachments.setValue("table_name", current.getTableName());
sysEmailAttachments.setValue("table_sys_id", current.getUniqueValue());
sysEmailAttachments.update();
}
}
-------------------------------------------------------------------------
If you found my response helpful, please consider selecting "Accept as Solution" and marking it as "Helpful." This not only supports me but also benefits the community.
Regards
Runjay Patel - ServiceNow Solution Architect
YouTube: https://www.youtube.com/@RunjayP
LinkedIn: https://www.linkedin.com/in/runjay
-------------------------------------------------------------------------
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎12-04-2024 06:00 AM
The attachment is copied in the activity log but is not showing on top of the record.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎12-03-2024 09:50 PM
Hi @Zuri ,
You should use below logic in your inbound action to copy the attachments from sys_email table to your table.
syntax:
GlideSysAttachment.copy('sourcetable','sys_id','destinationtable','sys_id');
example:
GlideSysAttachment.copy('sys_email', sys_email.sys_id, 'incident', incident.sys_id);
Refer this for more detailed
Please mark answer helpful/correct.
Thanks,
BK