Batch Import Devices/Users from a CSV file

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

Access Batch Import Users from the Vehicles panel options.

mceclip1.png



User Type

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.

mceclip0.png

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.

CSV file

The CSV file needs to have a minimum of 2 fields: username and IMEI. The header will look as follows:
username,IMEI

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:
username,IMEI
User1,999111999111
User2,999111999112

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. user@gpsgate.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.
Eg. accumulator.odometer.value,accumulator.odometer.datetime,accumulator.odometer.factor

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:
Username,Device1.Phonenumber,Device1.IMEI,Name,accumulator.odometer.value,accumulator.odometer.datetime,accumulator.EngineOn.value,accumulator.EngineOn.datetime,
User1,+11111111111,11111111111,User11,1111,2014-02-11T15:11:11,11,2014-02-11T15:11:11,
User2,+22222222222,22222222222,User22,2222,2014-02-12T15:22:22,22,2014-02-11T15:12:11,
User3,+33333333333,33333333333,User33,3333,2014-02-13T15:33:33,33,2014-02-11T15:13:11,
User4,+44444444444,44444444444,User44,4444,2014-02-14T15:44:44,44,2014-02-11T15:14:11,
User5,+55555555555,55555555555,User55,5555,2014-02-15T15:55:55,55,2014-02-11T15:15:11,
User6,+66666666666,66666666666,User66,6666,2014-02-16T15:06:06,66,2014-02-11T15:16:11,
User7,+77777777777,77777777777,User77,7777,2014-02-17T15:07:07,77,2014-02-11T15:17:11,

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.