Created
April 30, 2016 19:27
-
-
Save atulgupta31/845eae93a2c6547a03c0f6cefd807903 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
//Fetch the Profile Id that will assigned to the user | |
List<Profile> profileList = [SELECT Id FROM Profile WHERE Name='Standard User']; | |
//Instantiate a user variable | |
User testUser = new User(); | |
//if profilelist is not empty | |
if(!profileList.isEmpty()){ | |
//Create user | |
testUser = new User(Alias = 'standt', Email='standarduser@testorg.com', | |
EmailEncodingKey='UTF-8', LastName='Testing', LanguageLocaleKey='en_US', | |
LocaleSidKey='en_US', ProfileId = profileList[0].Id, | |
TimeZoneSidKey='America/Los_Angeles', UserName='standarduser@testorg.com'); | |
//insert user | |
Database.insert(testUser); | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment