Copy attachment to Incident inbound action
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎04-23-2018 03:09 AM
Hello,
I am using this code to create incident:
(function() {
/*try {
var strSubject = email.subject.toLowerCase();
if (strSubject.indexOf('re: ') == 0) {
return;
*/
var ih = new InboundUtils(email.to);
if (!ih.canCreate()) {
ih.sendReplyEmail(email.from, 'Sir/Madam', email.subject);
return;
}
current.assignment_group = ih.getInboundGroup();
current.category = "incident";
current.comments = "received from: " + email.origemail + "\n\n"
+ email.body_text;
current.short_description = email.subject;
var sid = gs.createUser(email.from);
current.caller_id = 'sid';
current.opened_by = 'sid';
//current.location = ih.getLocation(sid);
current.incident_state = 1;
current.contact_type = "email";
current.description = email.body_text;
current.insert();
/*} catch(err) {
var strErr = 'Error in Inbound Action : DEV Create Incident (Reply)'
+ '\n\nError Type: ' + err.name
+ '\nError message: ' + err.message;
logIt(strErr, 'error');*/
}
)()
Incident gets created fine, but if there is an attachment in the original email, it's not being copied over to Incident created. What part of the code am I missing? We're on Fuji.

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎04-23-2018 03:20 AM
Hi,
Try using
GlideSysAttachment.copy("source table", source table ID, "incident", incident sys id);
Thanks,
Ashutosh
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎04-24-2018 11:03 PM
Hi Ashutosh,
So am I right in my understanding that below should work?
GlideSysAttachment.copy('sys_email', sys_email.sys_id, 'incident', incident.sys_id); ?

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎04-25-2018 03:32 AM
Hi,
Yes you can use this.
Thanks,
Ashutosh
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎09-09-2022 08:04 AM
We have a domain-separated environment and we tried this but it does not work for us.
Our inbound action is in the global domain whereas the Incident target record is in the child domain.
While trying the copied API, it does not work but the same API works from the Backgroud script.
Any suggestions on how to make it work?