ETL Definition - How to set a referenced field on target

Community Alums
Not applicable

Hi SN Community,

 

Anyone know how to set a reference field in the target entity within an ETL definition?  I thought I'm suppose to set it to the sys_id but it's not working.  The referenced field is getting set as the sys_id but not as the referenced record.

 

I'll try to post some screenshots shortly.

 

Thanks,

Mike

 

 

1 REPLY 1

Community Alums
Not applicable

Hi @Community Alums ,

 

You are right reference fields use sys_id of the record.
You need to ensure that the data you are referencing (the sys_id of the referenced table) exists in the target table.

 

If the direct mapping is not working, you can use a transform script to handle the setting of the reference field, If reference records exists in target then below script should work for you. If record doesn't exist it will set the sys_id.

    var referenceSysId = source.source_ref_field;

    target.reference_field_name = referenceSysId;

 

If my response has resolved your query, please consider giving it a thumbs up ‌‌ and marking it as the correct answer‌‌!

 

Thanks & Regards,

Sanjay Kumar