We are sharing the video of the Workshop conducted by our technical team called USER IMPORT VIA CSV. In the video, we explain the import process with a practical exercise, along with some useful tips.
To watch the video, enter your first name, last name, and email address. Video of the Workshop.
In this article, you will learn how to import users to the SMARTFENSE Platform using a CSV file. Through this action, you can create new users and edit existing ones.
CSV File Structure
You can download an example CSV file using the Download sample CSV button on the platform. In the Users and Groups > User Import and Synchronization section, you will find the option Manually from CSV file. After selecting this option, click the Save button, and you will have the opportunity to download the sample CSV file.
If you want to edit users massively, you can either build the CSV based on the example or download your user list in CSV format from the Users and Groups > Users section. Upon this file, you can apply the desired modifications and then proceed with the import, as the CSV structure remains the same.
Below is an example line:
user1,first_name1,last_name1,email1@domain.com,"group-A;group-B","functionalarea-A;functionalarea-B","levelofhierarchy-A;levelofhierarchy-B",Active,Administrator,en-us,Employee-ID,phone,UPN
- If a user's language is not specified, they will be created with the es-ar (Spanish-Argentina) language.
- The users of the CSV file that do not exist on the SMARTFENSE Platform will be created.
- The users of the CSV file that already exist on the SMARTFENSE Platform will be updated.
- If you do not specify a username, it will be generated from the user's email address.
- It is possible to activate or deactivate users from the CSV file.
Clarifications
When a User is Created or Edited
If a user specified in the CSV file does not exist in the platform, they will be created. Otherwise, they will be updated.
The platform follows the logic outlined below:
For each user present in the CSV file, it will be checked if they already exist on the platform.
1) Search by email
The initial search is conducted based on the email listed in the CSV.
If the email in the CSV matches the email of an existing user on the platform, an edit will be performed on the existing user.
The editing involves updating all user fields with the new information provided in the CSV file. Here is a special case to consider:
1.1) Special case: username
If the username indicated in the CSV is different from the one the user already has, it will check if this new username is available. If it is available, the user's username will be updated without issues. If it is not available, this field will remain unchanged, and a warning will be displayed on the screen (the rest of the CSV data will still be updated). The warning will be visible when reviewing the import result. Users with warnings will be marked in yellow.
2) Search by username
If no user with the same email as listed in the CSV is found, it will proceed to search by the username listed in the CSV.
If the username in the CSV matches the username of an existing user in the platform, then an edit will be made to the existing user.
The edit will update all user fields according to the new information provided in the CSV file. Here is a special case to consider:
2.1) Special case: email
If the email indicated in the CSV is different from the one the user already has, it will check if this new email is available. If it is available, the user's email will be updated without issues. If it is not available, this field will remain unchanged, and a warning will be displayed on the screen (the rest of the CSV data will still be updated). The warning will be visible when reviewing the import result. Users with warnings will be marked in yellow.
3) User not found
If no user is found with the same email or username provided in the CSV, then a new user will be created with this data.
Capitalization
Usernames
The platform does not consider the capitalization used in the CSV when determining if a user already exists in the platform.
However, it does consider capitalization when creating a new user. If the username is written in uppercase, the platform will save it that way.
Groupings
The names of Groups, Functional Areas, and Levels of Hierarchy are identified considering the capitalization used in the CSV because there can be two different groupings with names differing only in capitalization.
However, it is possible to type the names of groupings in the CSV without capitalizing any letters since the platform, if it does not find the group as it was written, will search without considering capitalization.
Manually Created Groups
Groupings can be created manually or they can be created by an automatic import process. Manually created groups are not modified when importing users. For a better understanding of this case, an example is provided below:
- Group M: Manually created group
- Group A: Automatically created group from an import process
Let's suppose there is an existing user in the platform who is part of both groups. Then, through a CSV, it is indicated that the user should now be part of the following groups:
- Group C: New group that does not yet exist on the platform.
The result of the import will be that the user now belongs to the following groups:
- Group M: Since it is a manually created group, the automatic import process does not override it.
- Group C: It is a new group that has just been created by the import process.
Other cases
Users' email addresses will always be converted to lowercase regardless of how it was entered in the CSV file.
The first and last names of users will always be capitalized in the first letter of each word.
The UPN of users will respect the capitalization and lowercase usage as entered in the CSV file.
Empty fields
If the language of a user is not specified, they will be created with the language of the administrator user who performs the import action. If the user already exists in the database, the language configured in their profile will be retained.
If a username is not specified, it will be generated from the first part of the user's email address.
If an email address is not specified, the user cannot be imported.
If no status is specified, the user will be created with an "Active" status. If the user already exists, their current status will be retained.
If a role is not specified, the user will be created as an end user. If the user already exists, their current role will be retained.
If there are other empty fields, such as phone number, employee ID, or UPN, the user will be created or edited successfully. The respective fields will be left empty for the user.
Important: If you decide to leave a field empty in the CSV, its corresponding column must remain. If you remove columns from the CSV, the platform will not be able to interpret it correctly.