Sub topic 12
Creating many users at once
This chapter assumes you can create a single user in Setup, know the required user fields, and understand how a profile ties to a user licence. It covers two ways to create users in bulk, and the errors that usually appear.
Choose a method
Salesforce gives you two main options without writing code.
| Method | Best for | Limit |
|---|---|---|
| Add Multiple Users (Setup) | Up to 10 users with the same kind of access | 10 users per run |
| Data Loader | Dozens or hundreds of users from a spreadsheet | Limited by your API allowance and licence count |
Both methods require free licences. Check capacity first, as covered earlier, because a bulk load fails row by row when licences run out.
Add Multiple Users
In Setup, search for Add Multiple Users under Users. Pick the licence type, then enter a first name, last name, email, username and profile for each row. Salesforce fills in sensible defaults for time zone, locale and language. Each user receives a welcome email unless you clear the option to send it.
Load users with Data Loader
Data Loader inserts rows into the User object. Each row needs the same required fields you would fill in Setup.
LastName,FirstName,Email,Username,Alias,ProfileId,TimeZoneSidKey,LocaleSidKey,EmailEncodingKey,LanguageLocaleKey
Lovelace,Ada,[email protected],[email protected],alove,<ProfileId>,America/Los_Angeles,en_US,UTF-8,en_US
Hopper,Grace,[email protected],[email protected],ghopper,<ProfileId>,America/Los_Angeles,en_US,UTF-8,en_USReplace <ProfileId> with a real 15 or 18 character ID. You can find IDs with a query:
SELECT Id, Name, UserLicense.Name
FROM Profile
ORDER BY NameThe UserLicense.Name column shows which licence each profile consumes, so you can match rows to the capacity you checked.
Steps
- Export the profile IDs and confirm that licence capacity covers the number of rows.
- Build the CSV with one row per user. Keep every username unique across all Salesforce orgs.
- Open Data Loader, choose Insert, and select the User object.
- Map the CSV columns to the User fields. Auto-match works when the headers use API names.
- Run the load, then open the success and error files it produces.
After the load
Inserting users does not give them permission sets. Assign those separately, either in Setup or with a second load into the PermissionSetAssignment object, using the new user IDs from the success file.
Common bulk errors
- Duplicate username: usernames are unique across all orgs, so adding a suffix such as
.demoor your company domain avoids clashes. - License limit exceeded: the profile's licence has no free seats. Free some by deactivating users, or buy more.
- Required fields missing: a blank time zone, locale, encoding or language column fails the row.
- Invalid cross reference id: the
ProfileIdis wrong, or belongs to a different org than the one you are logged in to. - Bad email format: an invalid address fails the row.
Data Loader processes rows in batches. A failed row does not stop the others, so always fix the error file and reload only the failed rows. Reloading the whole file would hit duplicate usernames.
Exercise
You load 50 users with Data Loader and the error file contains 6 rows with "DUPLICATE_USERNAME". What do you do next, and why not reload the original file?
Show answer
Change the usernames in the 6 failed rows so they are unique, then load only those rows. Reloading the original file would try to insert the 44 users that already succeeded, and each of them would now fail with the same duplicate username error.