- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎01-06-2022 09:45 PM
I am trying to copy attachment from RITM to SCTASK record. I have written after-insert BR for that. its working when i submit the request by submitting the cat item. but to create RITM & SCTASK i have created one Inbound mail Action. its not working there. In the inbound mail action i have selected target table as "sc_req_item". So , the attachments coming from mail are getting attached directly to RITM record. but i want to copy the same attachments from the RITM to SCTASK record.
GlideSysAttachment.copy('sc_req_item', current.request_item, 'sc_task', current.sys_id);
This is the code i am using for copying attachment. Please if you can help. where should i debugg?
Solved! Go to Solution.
- Labels:
-
Service Catalog
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎05-30-2022 09:40 PM
Hope you are doing good.
Did my reply answer your question?
If my response helped you please mark it correct to close the question so that it benefits future readers as well.
Regards
Ankur
Ankur
✨ Certified Technical Architect || ✨ 9x ServiceNow MVP || ✨ ServiceNow Community Leader
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎01-06-2022 10:20 PM
Hi,
then in the workflow to create sc_task you must be knowing the RITM sys_id because you must be linking that SC Task with RITM
there you use this script during creation itself
Can you share how are you creating SC_task from workflow? and workflow is running on which table?
once you know the RITM sysId you can use the script to copy attachments
Regards
Ankur
Ankur
✨ Certified Technical Architect || ✨ 9x ServiceNow MVP || ✨ ServiceNow Community Leader
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎01-07-2022 02:09 AM
Hi Ankur,
I have created the workflow on sc_req_item table only. tried copy attachment code in create task, but not working. As i have selected target table as "sc_req_item" for inbound action, by default system is removing those attachments from the mail record & attaching them to RITM record. Is this affecting my logic?
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎01-07-2022 02:13 AM
Hi,
are you having attachments to RITM once inbound is processed?
Can you share script you are using in RITM workflow to copy attachment and are you using create catalog task activity?
where are you writing the copy script in workflow?
Regards
Ankur
Ankur
✨ Certified Technical Architect || ✨ 9x ServiceNow MVP || ✨ ServiceNow Community Leader
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎01-07-2022 02:20 AM
Hi Ankur ,
Yes i am able to see the attachments on RITM when inbound is processed. So i have written after insert BR
This the code written in BR=
gs.info('Testing BR');
GlideSysAttachment.copy('sc_req_item', current.request_item, 'sc_task', current.sys_id);
gs.info('Testing BR After');
I can see both info messages in log. but attachment is not copying
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎01-07-2022 02:43 AM
Hi,
so this BR is after insert on sc_task table
then the above script should work fine
try this
new GlideSysAttachment().copy('sc_req_item', current.request_item, 'sc_task', current.sys_id);
Regards
Ankur
Ankur
✨ Certified Technical Architect || ✨ 9x ServiceNow MVP || ✨ ServiceNow Community Leader