How can a case attachment or comments be copied to a task automatically?

Paul Bayani
Mega Expert

Hi! what configuration do I need to work on if I want a parent's case's files/attachments or even comments, copied/duplicate to its child task?

Thanks in advance!

1 ACCEPTED SOLUTION

Rob Sestito
Mega Sage

Hey Paul, 

I built a pretty easy UI Action on the Task form to do something like this.

Here is what I have - check it out and see if it works for you or not.

UI Action:

find_real_file.png

 

Script:

GlideSysAttachment.copy(current.parent.sys_class_name, current.parent, current.getTableName(), current.sys_id);

current.update();
action.setRedirectURL(current);

gs.addInfoMessage("Attachments have been added!");

gsftSubmit(null, g_form.getFormElement(), 'sysverb_update_and_stay');

 

And I also gave this UI action a required role as being the HR Basic.

Edit: I feel bad - did not even explain what this is doing. (sigh, c'mon Rob!!!)

So, This UI Action does the attachments. It copies all attachments from the HR Case onto the HR Task as a one-off. The person that does this, can be either the HR Case (parent) Assigned To OR the Assigned To of the child HR Task.

For Ex:

Here I have my own Password Reset Process that I built for our organization. I have a Word Doc attached to the Parent Case.

find_real_file.png

If I create a Task, I will see the UI Action 'Grab Attachments':

find_real_file.png

As you can see. there are no attachments yet on this Task. Once I click the button:

find_real_file.png

Attachment has been added to the Task form.

Now, I understand the reasoning behind wanting to grab attachments easily - but what is the reasoning behind wanting to copy over comments from Case to Task?

Cheers,

-Rob

View solution in original post

5 REPLIES 5

Rob Sestito
Mega Sage

Hey Paul, 

I built a pretty easy UI Action on the Task form to do something like this.

Here is what I have - check it out and see if it works for you or not.

UI Action:

find_real_file.png

 

Script:

GlideSysAttachment.copy(current.parent.sys_class_name, current.parent, current.getTableName(), current.sys_id);

current.update();
action.setRedirectURL(current);

gs.addInfoMessage("Attachments have been added!");

gsftSubmit(null, g_form.getFormElement(), 'sysverb_update_and_stay');

 

And I also gave this UI action a required role as being the HR Basic.

Edit: I feel bad - did not even explain what this is doing. (sigh, c'mon Rob!!!)

So, This UI Action does the attachments. It copies all attachments from the HR Case onto the HR Task as a one-off. The person that does this, can be either the HR Case (parent) Assigned To OR the Assigned To of the child HR Task.

For Ex:

Here I have my own Password Reset Process that I built for our organization. I have a Word Doc attached to the Parent Case.

find_real_file.png

If I create a Task, I will see the UI Action 'Grab Attachments':

find_real_file.png

As you can see. there are no attachments yet on this Task. Once I click the button:

find_real_file.png

Attachment has been added to the Task form.

Now, I understand the reasoning behind wanting to grab attachments easily - but what is the reasoning behind wanting to copy over comments from Case to Task?

Cheers,

-Rob

Thanks Rob as always! It worked for me!

 

Paul

Hi Rob!

Further to this query, I was testing the UI action (which is working!)...let's say the first time I clicked on the Grab attachment button, the parent case had attachment A, B, and C. 

So I go to the task and click on "Grab attachment" --the attachments A, B, and C were copied from the parent case to the child task. 

And then later on, I put in attachment D in the parent task. I go to the child task, click on "Grab attachment". This time, all attachments --> A, B, C, and D are copied to the child task from the parent  case.

At the end, I now have 2 copies of attachments A, B, and C in the child task, and 1 copy of attachment D. 

Is there a way to only grab files that have not been grabbed?

Hi paul,

I tried the same script but the attachments are not getting copied. Can you help me to check if the script is correct.