Take the 2-minute tour ×
Salesforce Stack Exchange is a question and answer site for Salesforce administrators, implementation experts, developers and anybody in-between. It's 100% free, no registration required.

I'm looking to automatically create a self service user ("Production" field on the opportunity layout is set to true), the lookup field to the contact is also on the opportunity layout. the new user should get an email with the login details also.

From what I found out, it is not possible to create SSP user via apex, only via API. I haven't found out calling API from a field change...any additional info will be helpful.

share|improve this question
add comment

2 Answers

I think the API is the only way to create these users.

Generally you could have used a combination of Triggers and email templates to accomplish this. But it appears that we cannot use DML statements (like insert) to create these users.

http://boards.developerforce.com/t5/Apex-Code-Development/How-to-enable-self-service-portal-automatically/td-p/202304

I have not tried creating these users from the API. A post in this thread suggests that even this may not be possible. http://boards.developerforce.com/t5/Apex-Code-Development/Testing-with-Self-Service-Portal-Users/td-p/264841

share|improve this answer
    
what i'm looking for is a documentation how to access the API from within SF (for example, when a certain field is changed) –  Itay B Dec 15 '12 at 13:03
2  
I believe you can hand the actual creation of the user off to a future method and the DML statements might be allowed there. –  joshbirk Jan 15 '13 at 0:20
    
Self service users can't be created by DML, even in @future. The SelfServiceUser object is restricted from DML per the Apex Doc –  crop1645 Jan 9 at 2:52
add comment

Try this (despite the title which at first glance looks irrelevant - the technique is the one you need as it addresses doing DML on objects that APEX can't do DML on like self service users)

Updating multi currency rates from Apex

You can make outbound call from APEX to the SFDC REST service and issue the necessary commands as if you were using the normal API from some 3rd party client. You can see my comment (under @crop1645) to see how the technique 'ought' to work for self service users

share|improve this answer
add comment

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.