create a record from attachment
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎12-01-2017 02:54 AM
Hi All,
I am trying to resolve this task. As an user I generate email with for instance 5 attachments. ServiceNow. ServiceNow Inbound action generates record with 5 attachments in ServiceNow. In my staging table based on record with 5 attachments, 1 revision/record is created for each attachment. After createion of 5 records/revisions the staging table record is deleted.
My idea is to copy or get these attachments to dms_document table from my staging table or directly and then force revision task. I was thinking about business rule that can be used in Inbound email action. I have found also getConent(GlideRecord sysAttachment) that can trigger this action in Inboud email action.
Looking for any ideas.
Many thanks
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎12-01-2017 11:07 AM
Hi.I dint get you requirement clearly but once I had to include an attachment and did like this: script to copy attachment from one table to other.So maybe it can help you.
var sourceSysID = '1db6b56e6fa58f4882d1cf164b3ee4bf'; //sys_id of kb_article
var targetSysID = current.sys_id;
var copyAtt = new GlideSysAttachment();
copyAtt.copy('kb_knowledge', sourceSysID, 'sc_req_item', targetSysID); //copying the attachment from kb_knowledge table to sc_req_item.
Let me know if it helps.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎12-03-2017 02:49 AM
Hi Marek,
Harshini has given you the code to copy attachments.
Just a note when you decide to copy incoming attachments. If you do not make a way to automatically delete these attachments in the future your instance Database will grow huge in size and you will have trouble later on for cloning etc. Especially if this feature is heavily used and has a lot of incoming attachments.
Regards,
Mohamad