Adding task attachments to parent case

Rob Sestito
Mega Sage

Hey Comm!

I have a simple task that I am trying to accomplish. I am blanking on the route to take for what I need.

I currently have a UI Action 'Grab Attachments' on the HR Task Table. Simply, it copies the parent attachments and posts them to the Task. I want to create the same scenario, only the other way. I want another UI Acton on the HR Case table, to copy the child task attachments when needed.

Here is what I have for the HR Task table UI:

find_real_file.png

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');

First, I thought I could change change the GlideSysAttachment.copy line to state child / task. But I was wrong - I am sure this is simple, but I am unable to accomplish the simple right now. Can someone lend a hand?

Thank you!

-Rob

1 ACCEPTED SOLUTION

Rob Sestito
Mega Sage

Thanks again everyone!

We are going to take a different route. Users want to be able to email HR Task Attachments in an easier way. In a way that allows them to select which attachments to email. I have a good process for that on the HR Case table - so I am going to recreate that on the HR Task table.

 

Cheers!

-Rob

View solution in original post

9 REPLIES 9

Phuong Nguyen
Kilo Guru

Hi Rob,

Try to check the "Client" checkbox and see if it works, since you are trying to use gsftSubmit function. But then what is your purpose of calling that function? You need that function only if you are running both Client-side and Server-side code but I am not seeing anything that you need to run on the client side in your UI Action?

Regards,

Phuong

If you find my suggestions helpful, please mark it as correct or helpful to help out others as well 🙂

Hey Phuong,

Thanks for your suggestion. I could use the client checkbox - but then I think I would have to create a function from a script include perspective, right?

If my UI Action on the Task form can just be what I showed above to grab attachments from the parent, how come I cannot reverse it?

Thank you!

-Rob

Abhishek Jain2
Kilo Contributor

pls try using:

var parentGr = current.parent.getRefRecord();

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

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

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

 

 

Tried the script - message part worked, but no attachment came over from the Task to the Parent Case.

Thanks,

-Rob

Rob Sestito
Mega Sage

Thanks again everyone!

We are going to take a different route. Users want to be able to email HR Task Attachments in an easier way. In a way that allows them to select which attachments to email. I have a good process for that on the HR Case table - so I am going to recreate that on the HR Task table.

 

Cheers!

-Rob