Note: for an updated version of this and other articles, we recommend you to check our knowledge base here
FEATURE: Batch User Import
This feature allows to import several users to an application using a CSV file.
How to install
Make sure your patches are up to date under SiteAdmin -> Plugins
Once updated, enable the _BatchUserImport privilege under the application; this privilege if found under Admin section of privileges.
How to use
The batch user import is based on User Types; therefore, before importing users a User Type needs to be defined. This can be done with the User type Editor.
The imported users will share all the settings set in the User Type. this includes Roles, Tags, and Devices.
Please note that an import can only be done to a User Type that has the _DeviceLogin privilege and do not have the _MobileLogin and _WebLogin privileges. The privileges can be set for each Role under Admin -> Roles.
The User Type needs to define a minimum of one Device. All the other fields are optional; however, if set, they will be the same for all imported users.
The CSV file needs to have a minimum of 2 fields: username and IMEI. The header will look as follows:
Username: The username of the user that is being imported
IMEI: The IMEI corresponding to the device that is being imported
An example of a CSV file is as follows:
This will import 2 users with one device each.
Once the CSV file is ready, open the Batch User Import under the vehicle list toolbar menu, select the User Type created in the previous step, choose the CSV file and click on Upload.
An import report window will appear once the import if completed. The report will provide the number of imported users and list all the failed imports, including a reason.
CSV file - Advanced
The CSV file can contain several other field in order to import users with much more settings. The header can contain those additional fields:
device1.IMEI: This is the same filed as IMEI, however it can be used when the user has more then once device. Then, device1, device2, or device3 needs to be specified.
device1.phonenumber: This is the same filed as phonenumer, however it can be used when the user has more then once device. Then, device1, device2, or device3 needs to be specified.
userphonenumber: The phone number of the user (not the device). Eg: +15145554433
Snippet name: The name of the user.
surname: The surname of the user.
email: The email of the user. Eg. email@example.com
description: The description of the user.
fuelconsumption: The expected fuel consumption the the vehicle. The value is in litres or gallows depending on the application settings.
color: The color of the vehicle marker. This needs to be in the hexadecimal format. Eg: 7ca530
Furthermore, Accumulators can be specified in the CSV file. The convention to add accumulators is as follows:
The header field needs to start by accumulator, followed by a dot (.), the accumulator name, followed by a second dot (.) and finally the value and date. Optionally, and only for the accumulator of type odometer, a factor can be added.
Odometer can be replaced by any accumulator name that is present within the application. Those can be defined in Accumulator Types under Admin. The value is in km or miles (depending on the application settings) for distance and hours for timed values. The datetime is in the ISO format and in the timezone of the application, Eg. 2014-02-14T15:44:44
An example of a advanced CSV file:
This file will create 7 users, with one device each and 2 accumulators; one of type Odometer and one of type EngineOn type.
The user import supports Custom Fields. The custom field first needs to be defined and added to the User type. More info at http://gpsgate.com/blogComment/custom_fields .
Custom fields are represented in the header as follows: customfield followed by a dot (.) and the custom field name: Eg. customfield.My Text Field
Example of a CSV file with the a custom field named My Custom Field of type text
Username,Device1.Phonenumber,Device1.IMEI,Name,customfield.My Custom Field
User1,+11111111111,11111111111,User11,My Text 1
User2,+22222222222,22222222222,User22,"My text, including a comma"
Custom Field types and their value representation:
Checkbox: The data can be yes, 1, or true for checked boxes and no,0,false for unchecked boxes.
Text and Paragraph Text: Any text can be added, however, if it contains a comma, it needs to be surrounded by quotations marks. Eg. "Hello, this is my paragraph."
List: The list value needs to the the Item name, the text displayed in the dropdown of the list.
Please Note that Accumulator and Custom Field names are case sensitive.
A user can only be imported once, therefore, if the same file is imported twice, no extra users will be created.
Please note that there is no undo for this function.
Once imported you can use Batch Update Users to import updates from a CSV file:
You can edit multiple properties of different users using the Batch Edit feature. You can modify in batches properties like Marker Colors, Marker Icons, Accumulators, Odometers, Custom Fields, Fuel consumption values, Roles and Tags.