Synchronization editor problem: mapping property with script retrieve object

Hi all,

I'm synchronizing a csv with the department objects

in my csv file I had a code for department manager that is equal to a code in field CustomProperty01 on Person object.

With the property "Key resolution by reference" I can insert the UID_Person in UID_PersonHead on Department object but...

If Person has a UID_PersonMasterIdentity is not empty I need to insert in UID_PersonHead of Department that UID.

So if a Person as a masteridentity attached to it I need to insert that person as department Manager.

I don't know how to do it in Synch Editor I thinkg with a script property but I can't figure out how.

 

Thanks 

Mik