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
NehaaNehaa 

New User Creation - Do not Generate an email to the user

Hi,

 

When we create a user in salesforce, I would like to restrict the login credential email to be sent. How can we restrcict the user receiving the login credentails at the time of user creation?

 

I would like to send the credentials later but not at the time of user creation. 

 

Any thoughts?

 

Thanks

Satish_SFDCSatish_SFDC
On the User creation page, if you scroll down there is Checkbox 'Generate new Password and notify user immediately'.
Uncheck this box and Click Save. The user will not be sent any notification

Hope this helps.
Regards,
Satish Kumar
Please mark my answer as a solution if it was helpful so it is available to others as a proper solution.
If you felt I went above and beyond, please give me Kudos by clicking on the star icon.
KodiKodi

Hi,

 

After creating a user in salesforce, through apex code and email will be send along login credentails at the time of user creation.

 

The below code,

User usercreate=new User();

.................................................

Database.DMLOptions dlo=new Database.DMLOptions();

dlo.EmailHeader.triggerUserEmail =true;

dlo.EmailHeader.triggerAutoResponseEmail=true;

usercreate.setOptions(dlo);


using checkbox field to when will send email with login credentails, however checkbox field is true or false after that save means email will be send.

 

        

Application Administrator 8Application Administrator 8
Hi,

Any luck with this? We really have a problem with user creation. Database DML options is set correctly but user does not get an email
on creation. This happens only in production enviroment and not in development. Any other had similar issue and a possible solution?

Any help is appreciated! Thanks!
ATUL GUPTA 94ATUL GUPTA 94
Hi, 
I am Also Facing same Issue ,if any luck  please let me know.
priyanshu nema 2priyanshu nema 2
Hi,
below code worked for me -

Profile profileId = [SELECT Id FROM Profile WHERE Name = 'Chatter Free User' LIMIT 1];
  
User usr = new User(LastName = 'test',
                     FirstName='test',
                     Alias = 'jliv',
                     Email = 'test@gmail.com',
                     Username = 'test@gmail.com',
                     ProfileId = profileId.id,
                     TimeZoneSidKey = 'GMT',
                     LanguageLocaleKey = 'en_US',
                     EmailEncodingKey = 'UTF-8',
                     LocaleSidKey = 'en_US'
                     );
Database.DMLOptions dlo = new Database.DMLOptions();
dlo.EmailHeader.triggerUserEmail = true;

 Database.insert(usr,dlo);  

 
Atchuth ReddyAtchuth Reddy
Hi all below code works for creating user and generating welcome email,


Profile p = [SELECT Id FROM Profile WHERE Name='Standard User']; 
System.debug('profile: ' + p.Id);
User newu = new User();
    newu.Alias = 'standt' ;
    newu.Email='some@gmail.com' ;
    newu.EmailEncodingKey='UTF-8';
    newu.LastName='Testing66' ;
    newu.LanguageLocaleKey='en_US';
    newu.LocaleSidKey='en_US'; 
    newu.ProfileId = p.Id; 
    newu.TimeZoneSidKey='America/Los_Angeles';
    newu.UserName='username4@testorg.com';  
    newu.IsActive=true; 
Database.DMLOptions dlo = new Database.DMLOptions();
dlo.EmailHeader.triggerUserEmail = true; 
dlo.EmailHeader.triggerAutoResponseEmail=true;
newu.setOptions(dlo); 
insert newu;