How to add attachment on the HR case using catalog attachment variable type?

Sneha_Krishna1
Tera Contributor

Hi,

Hope you are doing well.

I have an 'attachment' type variable in my record producer. When the user uploads any attachment, I want the attachment to get saved in the record created. But instead, it is hiding it.

I can see the entry created in sys_attachment but not on case,

How can I remove ZZ_YY before copying. I written this business rule 

Async - insert. it's not working. can you help?

 

Sneha_Krishna1_0-1694526754824.png

 

 

If I remove this zz_yy from sys_attachment manually from the table then it's adding the attachment on the case.

Sneha_Krishna1_1-1694526754823.png

 

Thanks

@Ankur Bawiskar 

25 REPLIES 25

@Sneha_Krishna1 

Glad to know.

Please mark my response as correct and close the thread.

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

@Ankur Bawiskar 

I have already marked your solution as helpful.

@Sneha_Krishna1 

Please mark it as correct answer as well and close the thread.

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

Three years later and you’re still saving me
I set the order to 1000 and it worked!! Thank you!!

Hi @Sneha_Krishna1

What order did you choose ?

I have to copy attachment to workforce admin table so I have written BR on same table with below script 


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


    var gr = new GlideRecord("sys_attachment");
    gr.addQuery("table_name", "ZZ_YY" + current.getTableName());
    gr.addQuery("table_sys_id", current.sys_id);
    gr.query();
    if (gr.next()) {
        gr.table_name = current.getTableName();
        new global.VariableUtil().copyAttachment(gr.sys_id, current.getTableName(), current.sys_id);
        gr.update();


    }
})(current, previous);