You are not logged in.
Hello,
These are just some notes from my experience using the data_injection plugin ("File injection") to get data into GLPI. I am posting them so in the future people who search on it can find this info. I searched before using the plugin but didn't find some of this info (maybe I missed some French stuff).
My experience is that you may need to tweak your data to import OK, but this plugin is very useful.
-- Notes: --
These are just from my experience, so some of them may be guesses.
1. A field marked as "Mandatory" for an import operation must contain unique data. I was importing user data, and at first marking my LAST_NAME field as mandatory, but this caused import errors when two users had the same last name. Instead, I added a unique login value for each user and added a LOGIN field to my CSV file. Then, I made only this value mandatory in the import options wizard ("defining the model").
2. Japanese names have to be enclosed in quotes, like this:
login1,"山田","太郎",foo@bar.com,Group1
login2,"山田","恵美子",baz@bar.com,Group2
In my experience, it does not hurt to enclose every field in quotes, which can make preparing the CSV file easier. I did not test, but you might need to quote other kinds of non-ASCII text data, like Russian names or Arabic or whatever.
3. If you are linking a field to a filed in a different database table than the primary one, you will get an "unsuccessful injection" warning if there is no value for that field. For example, I wanted to associate my imported users to a group. So, I had my CSV data containing the group name in one of the fields, like above. However, some users had no group, and this caused the warnings in the import log. (The "Datas injection" field of the import log said 'Data not found (FK_group=")'.)
So in my case, I made a dummy group and added that group name to the users with no group. This let me import without warnings.
Also, I don't know how the plugin determined which field of the Groups I wanted to use to link the users to the groups. I entered the group name in the CSV data, and the import process magically did the thing I wanted (associate it to the entity in a different database table by using the Name field). I *THINK* the plugin looks up records in other tables by "Name" when creating these associations.
4. In my experience, the import log always says "Datas to insert are incorrect" in the "Checking datas" field of the import log, even when there is no error and the result is "Import is successful". So, I ignored that.
5. I found I could not import objects of the same type with the same text in the "Name" field, even though that is possible in the web UI. The case was, I was importing accounts. We have several file server accounts, where the username is the same as accounts on the mail server. I imported the mail accounts OK, but when I tried to import the file server accounts from CSV, the data_injection plugin threw tons of errors saying "you do not have the rights to update datas". I think it was looking up other accounts by the Name field to detect if they existed.
Example: I am using Accounts plugin also (called compte in French I think). I usually make the "Name" field for an account the same as the login. My user John Smith has a mail server account with login jsmith, and also a file server account with login jsmith. Importing these two accounts would not work if the Name field for each account was to be jsmith. So instead, I made my CSV data such that each account had a different Name: "jsmith (mail)" and "jsmith (file server)".
I hope this info is useful to some future person! If somebody who knows more than me about it finds any error, please post to the thread. Thanks.
Offline
This is very helpful!
I will add it to the English version of the plugin documentation wiki.
Thank you very much!
Paul
Offline