Attachments not showing under "Attachments" in HR Agent Workspace

KonstantinoK356
Tera Contributor

Yokohama patch 1:
I have used the solution proposed by @Ankur Bawiskar in this threat:
https://www.servicenow.com/community/hrsd-forum/attachment-appearing-in-the-body-of-case-and-not-hea...
Although it is working on HR cases, when the case is a journey it is not. It is still under the HR service category with table sn_hr_core_case but it won't work in cases that launch a journey. Any idea if there is a BR or something preventing that? Where should i look?

6 REPLIES 6

Ankur Bawiskar
Tera Patron
Tera Patron

@KonstantinoK356 

the link where I shared solution is about copying/adding file from record producer variable to target record.

what's your business requirement and what script did you write and what debugging did you do?

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

Well i had this code originally:

(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();
        gr.update();
        new global.VariableUtil().copy(gr.sys_id, current.getTableName(), current.sys_id);
    }
})(current, previous);
With async / insert, and when i submitted a case with an attachment variable it would show under the "Attachments" in HR Agent Workspace (as expected). In all cases except ones that would launch a lifecycle event. I added a try catch but no error was showing in the logs. Now that i reverted the code back to the one above, it is not working for any case for some reason. Trying to figure out what else did i change.

KonstantinoK356_0-1749566326549.png

 

Sorry, i meant this code.

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

    // Add your code here
    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();
        gr.update();
        new global.VariableUtil().copyAttachment(gr.sys_id, current.getTableName(), current.sys_id);
    }

})(current, previous);
The other one has copy instead of copyAttachment.