How to copy the attachment from table record to record producer using UI action

naveen80
Tera Contributor

Hi Experts,

 

I was trying to attach the files of incident record to record producer on click of UI button.

 

I've tried 'GlideAttachment.copy()' which helps only from record to record, but not record to form.

 

Can you please advise, how to make this work.

 

Thanks in advance..!!

 

Regards,

Naveen.

1 ACCEPTED SOLUTION

@naveen80 

do this

1) create a string variable on record producer and give it higher order

2) pass the incident record sysId from URL parameter when you redirect user to record producer

3) use onLoad catalog client script and get that URL parameter value and set it in variable and hide it

4) then use Record producer script to copy attachment

GlideSysAttachment.copy('incident', producer.variableName, 'target_table', current.sys_id);

If my response helped please mark it correct and close the thread so that it benefits future readers.

Regards,
Ankur
Certified Technical Architect  ||  9x ServiceNow MVP  ||  ServiceNow Community Leader

View solution in original post

17 REPLIES 17

Hi @Samaksh Wani ,

 

Can you help me with the error, which I've mentioned below.

 

Regards,

Naveen.

naveen80
Tera Contributor

Hi @Ankur Bawiskar ,

 

Could you please help me with the solution or any other references.

 

Regards,

Naveen.

 

 

Ankur Bawiskar
Tera Patron
Tera Patron

@naveen80 

So you are redirecting user from incident record to record producer and want the file to be copied on that?

Once copies what should happen next? Usually the files will get attached to target record of that record producer

Regards,
Ankur
Certified Technical Architect  ||  9x ServiceNow MVP  ||  ServiceNow Community Leader

Hi @Ankur Bawiskar ,

 

Please find the below responses..!!

 

So you are redirecting user from incident record to record producer and want the file to be copied on that? - YES

 

Once copies what should happen next? - I was trying to show the user with pre-filled data in record producer variables and attach the files of the incident record to record producer.

 

User fills the additional information and required data in RP (Record Producer) variables and submit the request.

 

Our Motive : To show the attachments of Incident record in to Record producer while loading the RP from UI action button.

 

Regards,

Naveen.

@naveen80 

what's the motive of showing the files on record producer?

Did you try g_form.getUniqueValue() for portal?

Regards,
Ankur
Certified Technical Architect  ||  9x ServiceNow MVP  ||  ServiceNow Community Leader