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
jeremyyjeremyy 

Error: portal account owner must have a role

I have some test code that creates a portal user. The insert fails with the message "portal account owner must have a role".  

 

The owner of the Account and Contact has a Role, so I'm not sure what to do with this message.  

 

Anyone know how this can be fixed?

Best Answer chosen by Admin (Salesforce Developers) 
jeremyyjeremyy
Solved this.  The problem was the Contact's AccountId field was not being populated.  The error message was a little misleading in this case.

All Answers

jeremyyjeremyy
Solved this.  The problem was the Contact's AccountId field was not being populated.  The error message was a little misleading in this case.
This was selected as the best answer
SathyaincampusSathyaincampus
Awesome man!! Thank you so much!!!!!!! You saved my day!!
MohaMoha
Hello i've the same problem as u, but in my case when i want to have self registration from portalSite, it save the Account with the related contact but it gives me the SamesError as u "portal owner does not have a rôle" and i'm using HighVolume Customerportal as a profile