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
AnniAnni 

Trigger to convert from Contact to Portal user

Hi  All,

 

I  have written a trigger in Leads to convert the Leads from WEB-TO-LEAD   to  Contacts/Accounts.

But i dont know how to write a trigger to convert from contact to portal user. The event should be After insert.

Please anybody help me to sort out this issue.

 

regards,

Anni

bvramkumarbvramkumar

You can create portal user associated with Site method Site.createPortalUser(). If you want person Accounts to be Portal users you should use createPersonAccount​PortalUser(). See the full documentation here. http://www.salesforce.com/us/developer/docs/apexcode/Content/apex_classes_sites.htm

SRKSRK

Using Sites u can only create customer portal user not a partner portal user

whixh type of portal user u r try to create
u can not create portal user from code

AnniAnni

Hi  bvramkumar,

Thanks for your reply.

Can you send me sample trigger to convert the Contact to Customer portal User.

(Event is   after insert).

If i try to convert using Site.createPortalUser();

Throwing error as follows:

 

(System Code)
Trigger.ConverttoPortaluser: line 16, column 1
03:46:50.070 (6899180070089892)|FATAL_ERROR|System.TypeException: That operation is only allowed from within an active site.

(System Code)

 

Regards,

Anni

vanessenvanessen

Has you been able to solved it ?