Interested in a ServiceNow event built for developers? Registration for now[dev]26 is officially open!

Variable attachment not getting created in Attachment table

Mrman
Tera Guru

Hi ,

I created two variables of type 'Attachment' on a record producer and selected Map to field . I already created two File attachment fields on target table . The attachments are getting mapped to the field on Target table .

 

However these attachments are not seen in sys_attachment table .

I am trying to attach these fields to the Target record attachment in the header as per the below community link.But I am not seeing these records in with prefix zz_yy in attachment table .Please suggest.

 

https://community.servicenow.com/community?id=community_question&sys_id=41af7501db1ea010fa192183ca961983

@Ankur Bawiskar 

6 REPLIES 6

Mrman
Tera Guru

.

Ankur Bawiskar
Tera Patron

Hi,

the link you are checking has solution from me.

please create cross scope record

I assume you are in HR LE scope

Ensure you are in HR LE scope and create record

find_real_file.png

Regards
Ankur

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

Hi Ankur,

After submitting record producer by uploading attachment using attachment variable, it is not creating any record in attachment table.

I already created the cross scope record but still getting same cross scope error when using the following script in Record producer script.

 

var gr = new GlideRecord('sys_attachment');
if (gr.get(producer.<variable_name>) || gr.get(producer.<variable_name>)){ //attachment field name
	gr.table_name='sn_hr_le_case';     //copy to table name
	gr.table_sys_id=current.sys_id;//copy to record sys_id
	gr.insert();
	
}

Hi,

you created BR right? so it is in which scope?

Are you saying while submitting record producer when you add file it's not showing up?

Regards
Ankur

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