function readOnly(count){ }
Starting November 20, the site will be set to read-only. On December 4, 2023,
forum discussions will move to the Trailblazer Community.
+ Start a Discussion
viv1viv1 

Facing problem with password email ??

i am creating user record through apex ..

using following code :

 

Profile p = [select id from Profile where name='Standard User'];

User u = new User(alias = 'utest', email='kiran_machhewar@persistent.co.in',
emailencodingkey='UTF-8', firstName='First', lastname='Last', languagelocalekey='en_US',
localesidkey='en_US', profileid = p.id,
timezonesidkey='Europe/London', username='kiran_machhewar1234@persistent.co.in');

insert u;

 

 

but i am nor receiving password reset link ??

can i set my password in code itself ??

Rakesh KumarRakesh Kumar
If you wanna reset User password then you can use below code

System.resetPassword(user.Id, true);

this will reset the password and sent a message to given User
viv1viv1

cant we set our default passord here itself ??

bob_buzzardbob_buzzard
Yes - check the System class out:

http://www.salesforce.com/us/developer/docs/apexcode/Content/apex_methods_system_system.htm

This has set and reset password methods.