- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎06-14-2020 08:12 PM
If the instance received an email with attachments.
How could I include the attachments in the created task using inbound action?
Appreciate all the help.
Thank you.
Solved! Go to Solution.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎06-15-2020 12:51 AM
Hi
I think what is happening is your attachments are getting picked up by some other pre-defined OOTB inbound action, most probably "Create Incident". Can you go to the Inbound Actions list from the application navigator, and deactivate the Create Incident action, and then try?
Also, like i've mentioned above, you don't have to query the attachments explicitly and then associate it to the task, if you're doing current.insert/current.update already in your inbound action to create/update a task.
Thanks & Regards,
Rishabh Jha
Aavenir(http://www.aavenir.com/)
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎06-14-2020 11:56 PM
Hi Even,
You can update the new task sysid and task table name.
you jst need to replace the table name and sysid in the below script.
Replace the highlighted column with the created task sysyidand tabel name.
var sysAttach = new GlideSysAttachment();
var emailSysId = sys_email.getUniqueValue();
gs.log("Email sys_id is: " + emailSysId, "TITUS");
if (emailSysId) {
var sysEmailAttachments = sysAttach.getAttachments("sys_email", emailSysId);
while (sysEmailAttachments.next()) {
sysEmailAttachments.setValue("table_name", "tasktable"); // table name
sysEmailAttachments.setValue("table_sys_id", current.getUniqueValue()); //new task sysid
}
}
If not working then can you please give more details what you are doing in the inbound actions.
Please mark helpful and correct.
Thanks,
CB
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎06-15-2020 12:13 AM
Hi CB,
I'm using that code and I was able to create a task after receiving an email but it does not include the attachments.
Here is the code.
var sysAttach = new GlideSysAttachment();
var emailSysId = sys_email.getUniqueValue();
gs.log("Email sys_id is: " + emailSysId, "TITUS");
if (emailSysId) {
var sysEmailAttachments = sysAttach.getAttachments("sys_email", emailSysId);
while (sysEmailAttachments.next()) {
sysEmailAttachments.setValue("sc_task", "tasktable"); // table name
sysEmailAttachments.setValue("5e542ffe2ff0101056198d1df699b6f7", current.getUniqueValue()); //new task sysid
}
}
current.description = email.body_text;
current.short_description = email.subject.toString();
current.state = 3;
current.assignment_group.setDisplayValue("Service Desk");
current.insert();
event.state = "stop_processing";
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎06-15-2020 12:51 AM
Hi
I think what is happening is your attachments are getting picked up by some other pre-defined OOTB inbound action, most probably "Create Incident". Can you go to the Inbound Actions list from the application navigator, and deactivate the Create Incident action, and then try?
Also, like i've mentioned above, you don't have to query the attachments explicitly and then associate it to the task, if you're doing current.insert/current.update already in your inbound action to create/update a task.
Thanks & Regards,
Rishabh Jha
Aavenir(http://www.aavenir.com/)
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎06-15-2020 01:08 AM
Hi
Thanks for this input.
It's working now.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎06-15-2020 03:28 AM
I'm glad that it helped solving your issue!
Thanks & Regards,
Rishabh Jha
Aavenir(http://www.aavenir.com/)