You need to sign in to do that
Don't have an account?
Trigger to control User registration--Help required!
Hi,
I am trying to customize the site registration page, which comes out of the box.
when we put in our username,force.com appends customerportalid.na6.force.com to it. we could also login by just entering the username and no need to enter appended stuff.
But, what i am thinking is would it be possible to make username same as email, like the one we use for CRM login.
How can i accomplish this?
I tried writing a trigger on user object for after insert event and it quite did not work. Is there anything that i am missing.
Any ideas/help on this is highly appreciated.
trigger MatchUserNamewithEmail on User (before Insert)
{
if(Trigger.Isbefore && Trigger.IsInsert)
{
for(user u : Trigger.New)
{
if(u.userType.endsWith('PowerCustomerSuccess'))
{
if(u.Username!=u.email)
{
u.Username=u.email;
}
}
}
}
}
Thanks,
sales4ce
How about just doing this when you create the user in Apex?
Here's what I did:
Change this:
to this:
Then delete the username parameter from the visualforce page.
All Answers
How about just doing this when you create the user in Apex?
Here's what I did:
Change this:
to this:
Then delete the username parameter from the visualforce page.
Thanks Ryan, it worked fine.
I did not have to write a trigger. I was thinking way too complex.
Thanks,
sales4ce