You need to sign in to do that
Don't have an account?
Siva Sakthi
Hi,
Using this below code able to create the user successfully.' I want to get the newly inserted user Id Immediately ' .Once again we put the query to get a user id or Is any way to get the user id. how to get this . Using Userinfo.getUserId() we can get current loged in user. Please guide me to achive this .
Profile p = [SELECT Id FROM Profile WHERE Name='Standard User'];
User u = new User(Alias = 'standt', Email='standarduser@testorg.com',
EmailEncodingKey='UTF-8', LastName='Testing123', LanguageLocaleKey='en_US',
LocaleSidKey='en_US', ProfileId = p.Id,
TimeZoneSidKey='America/Los_Angeles', UserName='standarduserTestUser@testorg.com');
insert u;
Advance Thanks
Maheshwar
how to get the newly inserted user id
Hi,
Using this below code able to create the user successfully.' I want to get the newly inserted user Id Immediately ' .Once again we put the query to get a user id or Is any way to get the user id. how to get this . Using Userinfo.getUserId() we can get current loged in user. Please guide me to achive this .
Profile p = [SELECT Id FROM Profile WHERE Name='Standard User'];
User u = new User(Alias = 'standt', Email='standarduser@testorg.com',
EmailEncodingKey='UTF-8', LastName='Testing123', LanguageLocaleKey='en_US',
LocaleSidKey='en_US', ProfileId = p.Id,
TimeZoneSidKey='America/Los_Angeles', UserName='standarduserTestUser@testorg.com');
insert u;
Advance Thanks
Maheshwar
To get the User ID of the recently inserted user you simply invoke the u.id property if im not mistaken.
Hope this helps