Attachment

Prathyusha G
Tera Contributor

Requirement is On click of a button on Case table, new Case Record(child) should open in new tab by copying description, shot description and attachments from parent case and user can attach more attachments and submit the case.

Issue is description, shot description are copying from parent case to child case but attachments which are copied from parent case are not visible on the Child Case form but when we click on paperclip icon attachments are visible there.

Please, help me in solving the issue so that attachments should be visible on the child case form

9 REPLIES 9

Since you are opening the new record in a new tab, you should create the child record first, copy the attachments on it and then redirect the user to the new tab. 

But to copy the attachments we need unique id, we will get unique after form loads if I am correct

Can't you use the following

 

var hrCase = new GlideRecord('sn_hr_core_case');
hrCase.initialize();
hrCase.short_description = 'some description';
hrCase.parent = current.sys_id;
var childCaseSysID= hrCase.insert();
var attachment = new GlideSysAttachment();
var copiedAttachments = attachment.copy('sn_hr_core_case', current.sys_id, 'sn_hr_core_case', childCaseSysID);
action.setRedirectURL(hrCase);

Here user is redirect to the new record when the attachments have already transferred.

Thank you for your reply

 

Here record is creating and copying the attachments. But my requirement is attachments should be copied to new unsaved record and user will save/submit the record

 

On the new record, you will not be able to see the attachments copied via script until the record is saved.