Attachment uploaded in a task should be available in the next 2 tasks in a catalog item.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
10-31-2023 02:42 AM - edited 10-31-2023 02:57 AM
Hi @Ankur Bawiskar , we have a catalog item workflow in which we have 3 catalog tasks which are one after the other in the flow. So, we have a requirement that any attachment uploaded in task 1 should be available in task 2 and 3 as well.
For example: if any user submits the form and fulfiller attaches a document in the task 1 and closes the task, then this same document should be available/uploaded in task 2 and 3 as well.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
10-31-2023 03:52 AM
Hi Ankur,
We have not yet tried the script, we were figuring out whether to go with the workflow or the business rule. As per your suggestion, we will try a script and update you.
Thanks,
Amogh.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
10-31-2023 03:01 AM - edited 10-31-2023 03:03 AM
Hi @amogh_b6 ,
You can refer below URL to copy attachments on same table from one record to another. You can use this script in your catalog task script section
Please mark helpful/correct if my response helped you.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
10-31-2023 03:39 AM
Hi Anubhav,
Could you please share that URL?
Thanks,
Amogh.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
10-31-2023 04:22 AM - edited 10-31-2023 04:23 AM
https://www.youtube.com/watch?v=bA-lvIFrkcU
Sorry I missed out on giving the URL
Instead of directly giving out the sysid you can use in your catalog task script task.sys_id.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
10-31-2023 04:41 AM
Hi @amogh_b6 ,
U can create a after insert BR with below condition:
Here the idea is that the BR will only run in case of 2nd & 3rd Task creation. So u need to give proper item name by dot walking & short description of 1st task so that it does not run in that scenario.
In Advanced section u can run below script.(Please modify as per your requirement)
(function executeRule(current, previous /*null when async*/ ) {
// Add your code here
var task1 = new GlideRecord('sc_task');
task1.addQuery('request_item', current.request_item);
task1.addQuery('short_description', 'Enter shortdescription for task 1');
task1.query();
if (task1.query()) {
var gr = new GlideRecord('sys_attachment');
gr.addQuery('table_sys_id', task1.sys_id);
gr.query();
if (gr.next()) {
var copyAtt = new GlideSysAttachment();
copyAtt.copy('sc_task', task1.sys_id, 'sc_task', current.sys_id);
}
}
})(current, previous);
Thanks,
Danish