2.1 Обращение к объектом БД 1IM из маппинга

15 ноября 2022 г.

12:17

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 AsISystemObject= SystemObject.Connection.QueryObject(SystemQuery _

.From("Person") _

.Select("UID_PersonHead", "UID_PersonMasterIdentity") _

.Filter(String.Format("CustomProperty01='{0}'", value.ToString))

).Result.FirstOrDefault

IfNot Person Is NothingThen

IfString.IsNullOrEmpty(Person.GetValue("UID_PersonMasterIdentity").AsString) Then

\$UID_PersonHead\$ := Person.GetValue("UID_PersonHead").AsString

Else

\$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.

From \<https://www.oneidentity.com/community/identity-manager/f/forum/21645/synchronization-editor-problem-mapping-property-with-script-retrieve-object>