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
ClaiborneClaiborne 

Testing with Self-Service Portal Users

I asked this question during the recent webinar, but got no answer.

 

How do you test apex code that requires the use of self-service portal users when the DML operation to create self-service portal users is not allowed?

 

For now, outside of my test code, I have to create a dummy account, a dummy contact, and then a dummy self-service portal user. Then I have to hope no one deletes this by accident, or my test code no longer works.

 

I know that, like users, you cannot delete self-service portal users. But you can create users in Apex test code that go away when the test completes.

 

Why can't you create self-service portal users in apex code?

McFitz13McFitz13

Here is an example of your test class you need to use....

 

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

ClaiborneClaiborne

The test class is creating customer portal users, not self-service portal users. These are different objects.

 

How do you create a self-service portal user in a test class?

ClaiborneClaiborne

Also, as the comments note in the code, the customer portal user CANNOT be deleted, even though it is created in a test class. This goes against the whole notion of a test class.

 

This needs to be fixed at the system level. You can create temporary users in a test class. And these users to NOT count against your license totals. This same fix needs to be applied to all types of users - force.com users, customer portal users, and self-service portal users.

cmctamcmctam

Hey David

Did you ever find out how to make a self service user?

I'm trying with php so I can create more than 50 users at a time.

I think my code is correct.

I get now error but a user isn't created!

thanks

Tammy

ClaiborneClaiborne

I was never able to find any way to create the self-service portal user other than through the User Interface. There is nothing that can be done with the API.

 

One thing I did find is that through the API, can can reset the password for self-service users. But you cannot create them.

cmctamcmctam

Oh no!

I hate it when documentation lies.

Thanks for your quick response.

Saves me a lot of head banging!

Tammy