How can I add an email attachment to a request created from an inbound action?
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎08-04-2017 12:21 PM
Hello community,
I have an inbound action that creates a request,ritm and task but I can't get the attachment from the trigger email to attach to the req, ritm or task (like it works for an incident inbound action).
How can I determine why the attachment isn't coming over and/or how can I make the attachment carry over to the req /ritm or task?
I am a n00b -please be kind, all suggestions are greatly appreciated.
Thanks,
Heidi
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎08-04-2017 12:36 PM
Hi Heidi,
I would add this piece to your script in the inbound action:
GlideSysAttachment.copy('sourcetable', 'sys_id', 'destinationtable', 'sys_id');
If you can post your existing code, I can explain further on how to use this.
Thanks,
Ravi
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎08-04-2017 01:00 PM
Thank you!
This is my code:
createRequest();
function createRequest() {
gs.log('Executing......'+email.body.username.toString());
//Get Requested For
var usr = new GlideRecord('sys_user');
usr.addQuery('user_name',email.body.username.toString());
usr.addActiveQuery();
usr.query();
if(usr.next())
{
var grRequest = new GlideRecord ("sc_request");
grRequest.initialize();
grRequest.requested_for = usr.sys_id;
grRequest.short_description = email.body.url.toString();
grRequest.description = "received from: " + email.origemail + "\n\n" + email.body_text;
var requestSysId = grRequest.insert();
gs.log('Request Number...'+grRequest.number);
//Create Request Item
current.requested_for = usr.sys_id;
current.short_description = email.body.url.toString();
current.description = "received from: " + email.origemail + "\n\n" + email.body_text;
current.cat_item = '5f48751edb58030081d8f9b9af9619ca';
current.parent = requestSysId;
current.request = requestSysId;
current.approval = "approved";
current.insert();
//Create Task
var grTask = new GlideRecord ("sc_task");
grTask.initialize();
grTask.requested_for = usr.sys_id;
grTask.short_description = email.body.url.toString();
grTask.description = "received from: " + email.origemail + "\n\n" + email.body_text;
var taskSysId = grTask.insert();
current.cat_item = '5f48751edb58030081d8f9b9af9619ca';
current.approval = "approved";
}
}

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎08-04-2017 01:06 PM
Ideally it should get automatically attached to the Requested item. What is the size of the attachment?
Please mark this response as correct or helpful if it assisted you with your question.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎08-04-2017 01:10 PM
38 KB. From what I am understanding the attachment should by default be attached to the first record created (the request), but the attachment isn't on the req, ritm or task.