OnAfter or Field map script transform script help needed

E_19
Giga Expert

Hi All,

Can someone advise on how I should approach the below requirement:

I have load a list of companies into core_company table.

They all have a customer id, debit group id which is often the same but not always

After each load I would like to run an onAfter script to take the debit group id and find the matching name in the core_compnay table

and add this to the reference field Parent.

comp id                                                                                                                                                                                                                                                                                                               Parent field should result in             Debit group id                

100000xyz companystreet 19LondonUKxyz company100000
100001abc Ltdway 1BerlinDEabc Ltd100001
100004time Ltdlane 2 ZürichCHxyz company100000
100005now Ltdroad 3New YorkUSAtime ltd100004

Any suggestions greatly appreciated.

Thanks,

Ellie

16 REPLIES 16

venkatiyer1
Giga Guru

May be there is a typo


target.parent = gr.sys_id;


Hi srnewbie, Venkat,



I got this resolved. When the company id and debit group value are same then you cannot add as you cannot be your own parent.


For records with different debitor group the parent was added.



Thank you very much for your effort to help me with this


Ellie