- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎07-19-2017 01:23 AM
Hi Team,
I need a way to copy attachments from Ritm to Task and from Task to Ritm.
I am able to achieve, copying of attachments from Task to Ritm by using a business rule. But I also need to copy attachments from Ritm to Task without any duplicates.
Could any one help me in resolving the Task.
Let me know if I need to provide any other details.
Thanks in advance.
Regards,
Sampath.
Solved! Go to Solution.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎07-19-2017 01:56 AM
Hi Sampath,
I also had the same requirement.TASK to RITM is achievable because child-parent relationship .
We faced some problems in attachment so that instead of adding attachment RITM to catalog TASK ,I acheived it with the relationship (Created a related list on Catalog TASK table).
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎07-19-2017 01:44 AM
Hi Sampath,
Yes, you can achieve the same with the help of async business rule on Attachment [sys_attachment] OR Request Item [sc_req_item] table. To copy the attachment, use the below code:
First, get the sys_id of the attachment, you wanted to copy to task table or vice versa.
var gr_atch = new GlideRecord('sys_attachment');
gr_atch.get('fc4e0d41db08430038d7fd131d96193b'); // Attachment sys_id
var gr_atch_new = new GlideRecord('sys_attachment');
gr_atch_new.initialize();
gr_atch_new.compressed = gr_atch.compressed;
gr_atch_new.content_type = gr_atch.content_type;
gr_atch_new.size_bites = gr_atch.size_bites;
gr_atch_new.size_compressed = gr_atch.size_compressed;
gr_atch_new.file_name = gr_atch.file_name;
gr_atch_new.table_name = 'sys_email'; //target table name
gr_atch_new.table_sys_id = current.getValue('email'); // target table sys id
var newID = gr_atch_new.insert();
Please, let me know, if you have any query related to the above code.
Regards,
Vipul
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎07-19-2017 01:56 AM
Hi Sampath,
I also had the same requirement.TASK to RITM is achievable because child-parent relationship .
We faced some problems in attachment so that instead of adding attachment RITM to catalog TASK ,I acheived it with the relationship (Created a related list on Catalog TASK table).
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎07-19-2017 03:48 AM
Thanks for your quick response VimalPriya.
This worked really great
Thanks,
Sampath.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎04-20-2018 10:51 AM
Hello How to limit this to only one catalog item?