+ Start a Discussion
JeriMorrisJeriMorris 

Pre-Registering Sites users

When someone inside my company (with a System Admin login into Salesforce) creates a new Site, they want to be able to pre-create a few throusand new Sites logins, based on CampaignMember data, and then send email messages out to those people, giving them their login information. They don't want the Campaign Members to have to self-register for a Sites login. Is there some way I can write Apex code (maybe in a Visualforce controller, or maybe in a batch Apex process) that finds all the relevant Campaign Members and then creates Sites logins for them?

 

Thanks!

RyanGuestRyanGuest

Yes, this is possible with Apex.

 

Since sites users are just customer portal users behind the scenes, you just need to double check the users are associated with the correct portal.

 

Have a look at this article: Provisioning Customer Portal Users with Apex

http://blog.sforce.com/sforce/2009/04/provisioning-customer-portal-users-with-apex.html

JeriMorrisJeriMorris

Thanks for your reply!

 

From the article you referenced, it looks like we can't pre-create a whole bunch of Sites users using the Data Loader. We'd have to create a bunch of Contact records (maybe using the Data Loader), and then create separate User records for each one.

 

When we create a User record this way, can we define the password ourselves, or is it always auto-generated?

RyanGuestRyanGuest

I can't remember if you can set passwords or not using the data loader, I'd suggest giving it a try to find out.

 

What I can remember is that you can set the password on a user from Apex.

 

Using this method:

 

System.setPassword(userId,password); 

 

So if you get stuck and you're comfortable writing code, you could use this method to set the password for the users.