User Story
As a Salesforce administrator, I want to automate the creation of a new user with the System Administrator profile. This will streamline the user onboarding process and ensure consistency in user account setup.
Acceptance Criteria:
- A new user with the first name 'Engin' and last name 'Basturk' should be created.
- The user's alias should be generated using the first two characters of the first name and the first two characters of the last name in lowercase.
- The user's email address should follow the format 'Engin.Basturk@amaon.com'.
- The user's Salesforce username for development purposes should be 'Engin.Basturk@amazon.com.dev'.
- The user's time zone should be set to 'America/New_York'.
- The user's locale should be set to 'en_US'.
- The user's email encoding key should be set to 'UTF-8'.
- The user's language locale key should be set to 'en_US'.
- The user should be assigned the 'System Administrator' profile.
Apex Codes
Profile pr = [SELECT Id, Name FROM profile WHERE Name ='System Administrator'];
User newUser = new User ();
String FirstName='Engin';
String LastName='Basturk';
newUser.FirstName =FirstName;
newUser.LastName =LastName;
newUser.Alias=FirstName.substring(0,2)+LastName.substring(0, 2).toLowerCase();
newUser.Email=FirstName+'.'+LastName+'@amaon.com';
newUser.username=FirstName+'.'+LastName+'@amazon.com.dev';
newUser.TimeZoneSidKey='America/New_York';
newUser.LocaleSidKey='en_US';
newUser.EmailEncodingKey='UTF-8';
newUser.LanguageLocaleKey='en_US';
newUser.ProfileId=pr.Id;
insert user;
Video
Video does not exists.