:: Version 3.2.0 ::

Import a LinkedSet

What is a linkedset?

It is an attribute that represents a list of related objects. It is displayed as a tab in the details of the object. There are two types of LinkedSet:

  • 1:n - Devices on a Location : a Device is located in a single location. On a Location, there might be multiple Devices.
  • n:n - Members (Person) of a Team : a Person can belong to multiple Teams. Teams are made of multiple Persons.

Only n:n linkedset can be imported. You cannot import the related objects themselves, they must exist in iTop already.

Example: UserLocal has the attribute profile_list. This represents the list of profiles attached to an object UserLocal, by the mean of the class lnkUserProfile

All of the data input features do provide you with the capability to specify a link set:

If you're using interactive CSV import, don't forget to check the “advanced mode” option available in step 3, otherwise the linked set import won't work. This option is available to admin profiles only.

Example: importing users

Example for importing allowed organizations and profiles at the same time as importing the users. Those 2 attributes are many-to-many relationships:

  • Let's imagine that I want to allow 3 organisations to the same user.
  • Each of the Organizations in the source file can be identified by their id, name or code.
  • The fields which are expected when loading a AttributeLinkedSetIndirect like Allowed Organizations, are those of the n:n relation class, (here URP_UserOrg), which means that you could only provide allowed_org_id.
  • But in general, with n:n relationships, what you know about the remote object, are some of its fields values but maybe not its iTop id. In this case, you can specify a code from the remote object and there is a special syntax for this:
Syntax to import n:n relationships within objects: (remote objects must exist in iTop)
  1. ExternalKey in the relation class, pointing to the remote object (eg. allowed_org_id)
  2. a dash caracter followed by a superior: ->
  3. code of the remote attribute (eg. name)
  4. a colon :
  5. the value to retrieve the remote object (eg. Demo)
  6. a pipe, to separate 2 remote objects, needing to be linked to the same user
  7. and again the 5 first bullets above

like this “allowed_org_id->name:Demo|allowed_org_id->code:IT”

Syntax when providing iTop id is special:
  • allowed_org_id->id:4 does not work!
  • use instead allowed_org_id:4

In this example, I am combining different means to identify organizations in a many to many relationship, for the same user, that works, also you probably won't use it every day.

login-with-organizations.csv
Person->Email,Login,Language,Password,Profiles,Allowed Organizations
"monet@demo.com","portal","EN US",1234,"profileid->name:Portal user","allowed_org_id->code:IT|allowed_org_id->name:Demo|allowed_org_id:1"

Advanced options

Let's take an example. I would like to specify a list of profiles for a user and for each profile specify the reason why he should have it. The reason is a field of the many-to-many relationship.

First, attach one single profile:

profileid->name:Configuration Manager

Profiles are attached by the mean of the class URP_UserProfile->profileid. Here I have specified that the attribute name of the class URP_Profile must match 'Configuration Manager'.

Now, I want to keep track of the reason why this person has this profile:

profileid->name:Configuration Manager;reason:operations manager

Finally, I need to give another role to the same login:

profileid->name:Configuration Manager;reason:operations manager|profileid->name:Change Supervisor

Each and every link is specified independently for the others.

Each new link specification must be preceded by '|'.

Now I would like to specify a reason, but I need to use a character that is understood as being a separator:

profileid->name:Configuration Manager;reason:operations manager|profileid->name:Change Supervisor;'reason:manager ;-)'

The whole attribute specification can be surrounded by quotes.

Limitations / Known issues

External Fields (such as such as org_name) cannot be used as reconciliation keys
Workaround: org_name can be replaced by org_id->name
Limitation: the arrow operator (->) cannot be used mutiple times
i.e. virtualhost_id->org_id->name is not supported.
When you import a LinkedSet you must provided the full list of values in that LinkedSet. If you just want to add Links without touching existing ones, then import the relationship class

Configuration

In the configuration file, you can change the following:

  • separator between two items in the list: link_set_item_separator
  • separator between two attributes: link_set_attribute_separator
  • separator between the attribute name and the value: link_set_value_separator
  • qualifier for the whole attribute: link_set_attribute_qualifier
3_2_0/advancedtopics/import_a_link_set.txt · Last modified: 2024/09/10 10:25 by 127.0.0.1
Back to top
Contact us