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
simhasimha 

when new user is created for the customer portal emailalert is not going to the customer

Hi

          Im practicing on the Customer portal, Using developer guide 14 chapter i able to create a login page for customer portal and users can able to sign up every thing is going on correctly , but when a new user Register for a customer account he is not able to reciving the email about his registration has successfully completed, but if the forgot password is used they are able to recive the mail alert. If anyonehaveidea about this please help me

Best Answer chosen by Admin (Salesforce Developers) 
aalbertaalbert

Try setting the DMLOptions on the User object:

 

  Database.DMLOptions dmo = new Database.DMLOptions();
dmo.EmailHeader.triggerUserEmail = true;
User u = new User(alias = 'standt', email=email,
emailencodingkey='UTF-8', lastname=lastname, languagelocalekey='en_US',
localesidkey='en_US', profileid = profileId, contactId=contactId,
timezonesidkey='America/Los_Angeles', username=username);

u.setOptions(dmo);

 

 

 

 

A full example is listed here:

http://wiki.developerforce.com/index.php/ExampleApexCustomerPortalUser

All Answers

aalbertaalbert

Try setting the DMLOptions on the User object:

 

  Database.DMLOptions dmo = new Database.DMLOptions();
dmo.EmailHeader.triggerUserEmail = true;
User u = new User(alias = 'standt', email=email,
emailencodingkey='UTF-8', lastname=lastname, languagelocalekey='en_US',
localesidkey='en_US', profileid = profileId, contactId=contactId,
timezonesidkey='America/Los_Angeles', username=username);

u.setOptions(dmo);

 

 

 

 

A full example is listed here:

http://wiki.developerforce.com/index.php/ExampleApexCustomerPortalUser

This was selected as the best answer
simhasimha
thanks alot mr. Aalbert , its working  thank u very much..