HR case - While submitting the HR case, the attached document is not getting attached to the HR case

snehalkausa
Tera Contributor

Hi,

Issue: HR case - While submitting the HR case, the attached document is not getting attached to the HR case.

I have a Record Producer that creates an HR Case in the Talent Management COE (sn_hr_core_case_talent_management).

The producer contains an Attachment variable (Variable Type = Attachment) that allows users to upload a file during submission.

When the Record Producer is submitted:

The HR Case is created successfully. The uploaded file is created in sys_attachment.However, the attachment is stored with:

table_name = ZZ_YYsn_hr_core_case_talent_management

instead of:

table_name = sn_hr_core_case_talent_management
As a result, the attachment does not appear in the Attachments related list or on the HR Case

To resolve this issue- I tried by writing after insert BR but since the table sys_attachment is in global scope and the scope of the HR case is HR core application - it did not work.(
Scope does not have write access to table sys_attachment). 

I also tried updating sys_attachment via Flow Designer, but received:

Scope does not have write access to table sys_attachment, because the flow runs in the HR Core application scope.
When I tried with OOB platform attachment -it did work but I cannot use it as I want attachment mandatory or non-mandatory based on HR case variable inputs.

What is the recommended way to move/reassociate these attachments to the HR Case?
Thanks in advance!

2 REPLIES 2

Tanushree Maiti
Tera Patron

Hi @snehalkausa 

 

Refer KB: KB0868420 Why do some attachment records have ZZ_YY appended before the table name column in sys_att... 

 

Disable ZZ_YY prefix from attachment when added through record producer 

 

 

Please Accept the solution if it assisted you with your question & Mark this response as Helpful.
Regards
Tanushree Maiti
ServiceNow Technical Architect
LinkedIn: https://www.linkedin.com/in/tanushreemaiti

Ankur Bawiskar
Tera Patron

@snehalkausa 

this script worked for my record producer in HR Integrations Scope

I wrote this in record producer script

new global.VariableUtil().copyAttachment(producer.<variableName>,'<tableName>', current.sys_id);

Output

Record Producer Script

55.png

File got attached to the HR Case record without any scope issues

hr case attachment type variable copy to target.gif

💡 If my response helped, please mark it as correct and close the thread 🔒— this helps future readers find the solution faster! 🙏

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