You need to sign in to do that
Don't have an account?
NicoUruguay
Generate new password and notify user immediately
Hi:
I'm working in a Visual Force page that will override the Self-Service User Edit page. In Salesforce standard page, exist a checkbox: "Generate new password and notify user immediately".
I need to replicate this functionality in my custom controller. Is there apex "out of the box" functionality or should I code it? Is that possible?
Thanks,
nico.
Thanks!!
One possible solution could be accesing Salesforce via Api??
Thank you,
nico.
All Answers
Are you creating a new user record in your controller? To send the email, you need to set the DMLOption
There is an example here
Hi.
I need to create or update a SelfServiceUser in my controller. When I compile, for example, this code:
public with sharing class SelfServiceCreation {@futurepublic static void Create(){ List<SelfServiceUser> l = [Select Username, Name, Id, FirstName, Email, ContactId From
SelfServiceUser WHERE Email = 'oneEmail@gmail.com']; if (l.size() > 0){
l[0].Username = 'NewUserName'; update l;
}}}
The system return this error: DML not allowed on SelfServiceUser.
Any idea? Thanks,
nico.
Thanks!!
One possible solution could be accesing Salesforce via Api??
Thank you,
nico.
Database.DMLOptions dmlo = new Database.DMLOptions();
dmlo.EmailHeader.triggerUserEmail = true;
dmlo.EmailHeader.triggerAutoResponseEmail= true;
user.setOptions(dmlo);
insert user;
this is working fine... the above code missed a line...
Database.DMLOptions dmlo = new Database.DMLOptions();
dmlo.EmailHeader.triggerUserEmail = true;
dmlo.EmailHeader.triggerAutoResponseEmail= true;
dmlo.EmailHeader.triggerOtherEmail = true;
user.setOptions(dmlo);
insert user;