You need to sign in to do that
Don't have an account?
Tej
User not recieving new user email with login credentials when created through apex.
This functionality is working for a very long time and it stopped recently not sure why.
we have to create a user through apex and grant them customer portal access and they should be recieving a welcome email with their login credentials.
Please take a look at our existing code. Its' giving them the portal access but not sending the email,
User portalUser = new User(); portalUser.Alias = con.Name.substring(0,2)+ultility_GlobalFunctions.generateRandomString(3); portalUser.Username = con.Email; portalUser.FirstName = con.FirstName; portalUser.LastName = con.LastName; portaluser.CommunityNickname = con.Name.substring(0,2)+ultility_GlobalFunctions.generateRandomString(5); portalUser.Email = con.Email; portalUser.Cost_Center__c = 'None'; portalUser.Country = 'USA'; portalUser.Region__c = 'AMER'; portalUser.ContactId = con.Id; portalUser.ProfileId = [select Id from profile where Name= 'Manager'].Id; //portalUser.UserRoleId = [select Id from UserRole where Name = :recordtype].Id; portalUser.emailencodingkey='UTF-8'; portalUser.languagelocalekey='en_US'; portalUser.localesidkey='en_US'; portalUser.timezonesidkey='America/New_York'; Database.DMLOptions dlo = new Database.DMLOptions(); dlo.EmailHeader.triggerUserEmail = true; dlo.EmailHeader.triggerAutoResponseEmail= true; try{ portalUser.setOptions(dlo); insert portalUser; }catch( exception ed){ }
Please help...
KevinP
if you're testing this in a sandbox or dev edition have you gone in and turned on the email sending?