Tuesday, 27 May 2025

create a user without querying the ProfileId



Create a Salesforce User without Querying the Profile Id

ex:

 User user= new User(

LastName=‘Some Last Name’,

Alias = ‘ Some Alias’,

Profile = new Profile (Name =‘Standard User’), // <== idLookup

Username=‘SomeUserName@someemail.com’,

Email=‘SomeEmail@someemail.com’,

TimeZoneSidkey=‘America/Los_Angeles’,

LocalSidKey=‘en_US’,

EmailEncodingKey=‘UTF-8’,

LanguageLocalKey=‘en_US’

);


Insert user;



No comments:

Post a Comment