Attachment is not getting added from record producer to custom table record

Amol Pawar
Tera Guru

Hi experts,

 

I have created a record producer where I have added a variable of type 'Attachment'. I'm able to add attachments in the record producer but I'm unable to get that attachment in my custom table records.

Does anyone know what is the cause behind this?

I've created a custom table to get the records created by that record producer. 

Please let me know what is the root cause and solution to this issue.

AmolPawar_0-1693548723588.png

As you can see, I can add an attachment in the record producer but unable to see it in the custom table records.

AmolPawar_1-1693549167574.png

 

Thanks in advance!

Amol

4 REPLIES 4

karthiknagaramu
Kilo Sage

Hi,

 

Please check this community post. It could be helpful.

 

https://www.servicenow.com/community/developer-forum/unable-to-attach-the-attachments-from-record-pr...

 

Regards,

Karthik Nagaramu

Amol Pawar
Tera Guru

Hi @Ankur Bawiskar,

 

Could you please help me with my scenario?

I want to see attachments in header menu.

 

Thanks in advance,

Amol

Ankur Bawiskar
Tera Patron
Tera Patron

@Amol Pawar 

this should help

(function executeRule(current, previous /*null when async*/ ) {

// Add your code here "ZZ_YY"
var gr = new GlideRecord("sys_attachment");
gr.addQuery("x_infte_intellectu_brandname_clearance", "ZZ_YY" + current.getTableName());
gr.addQuery("ca954dd0c3f83d102f7798bc7a013179", current.sys_id);
gr.query();
if (gr.next()) {
gr.table_name = current.getTableName();
gr.update();
new global.VariableUtil().copyAttachment(gr.sys_id, current.getTableName(), current.sys_id);
}
})(current, previous);

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

Hi @Ankur Bawiskar ,

Thank you for your quick reply, I'll try it.

Thanks,

Amol