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.




  • Hi Michele,

    as you have assumed, you need to define a Script property to achieve your goal.

    In the script you have access to the properties of the current object, the current value when the sync engine tries to set a property and you can query for other objects the connector has access to, defined by your current schema definition (we come to that in a second).

    The sync engine itself, and therefore the scripted property has no direct access to the OneIM database, the object layer or the script library.

    Having explained that, here is your solution:

    • You need to define script property on the OneIM (the left) side of the mapping in the Department objects. In my sample, it is called vrtPersonHead. 
    • As in your use-case definition, we only need a write script.
    • Script code is the following:
    Imports VI.Projector.Connection

    Dim Person As ISystemObject = SystemObject.Connection.QueryObject(SystemQuery _
    .From("Person") _
    .Select("UID_PersonHead", "UID_PersonMasterIdentity") _
    .Filter(String.Format("CustomProperty01='{0}'", value.ToString))

    If Not Person Is Nothing Then
    If String.IsNullOrEmpty(Person.GetValue("UID_PersonMasterIdentity").AsString) Then
    $UID_PersonHead$ := Person.GetValue("UID_PersonHead").AsString
    $UID_PersonHead$ := Person.GetValue("UID_PersonMasterIdentity").AsString
    End If
    End If
    • You need a mapping from your CSV column that stores the Manager lookup value to the new script property. In my sample, this is the mapping column CustomProperty01 in my CSV file to the script property vrtPersonHead.

    • You need to pin the Person objects in your schema, as the connector is only able to access objects that are part of your sync project schema. So when you shrink the schema, you need to exclude the Person table from the shrink, when it isn't a part of your sync project already.

    The script demonstrates the use of:

    • How to query data from other objects that are part of your sync project.
    • How to set another property in your object (:= notation) in a write script
    • How to us the current value in a write script.

    Hope that helps.

  • Hello Markus,

    Would it be possible to retrieve all the UNSGroupB (Groups) that a single UNSAccountB (User) belong to using the script property?

    I'm trying to query multiple data that exist in the UNSAccountBInUNSGroupB.

    Best regards

  • I am not fully understanding your use case, but the SystemObject.Connection.QueryObject returns more than one object by default. That's why there is the FirstOrDefault part of the code in this thread.

Reply Children
No Data