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

Portal users cannot own partner accounts

I am trying to create a Contact via a portal user on Sites, but it's giving me this error. Can anyone tell me why this error is occurring and how to fix the problem?


System.DmlException: Insert failed. First exception on row 0; first error: UNKNOWN_EXCEPTION, portal users cannot own partner accounts: []



I also get an error when I try to save the Account of the portal user normally through Salesforce:


Cannot Assign Portal Account or Contact to Portal User
You cannot assign a Portal Account or Contact to a Portal user. Please choose a different user.


But I do not get any error creating the contact through Salesforce itself.

Here is the code I am using:



Contact p = new Contact();

p.FirstName = FirstName;
p.LastName = LastName;
p.Email = '';
p.AccountId = core.getUserAccount().Id; // This custom global method gets the account id (successfully)

try {
insert p;
}catch(DMLException e){
core.message.add(String.valueOf(e), 'error');




Thanks in advance
Message Edited by admintrmp on 11-11-2009 08:52 AM
Only Partner Portal user license give your full permission on Accounts and Contacts object. Customer Portal license provids read only access on Accounts and Contacts.

How can I make users within the Customer Portal Profile (of whom are registered through Sites) a member of the portal partner profile? And surely if I do this, they will no longer have access to site authentication?


I am trying to allow users to create contacts within Sites. What would be the best way of doing this if a member of the customer portal profile cannot do this?

Message Edited by admintrmp on 11-12-2009 02:49 AM

Okay, I've figured out that the Partner Portal is a different thing to the customer portal.


Is there no way for my site users to create contacts on an account which is setup for the customer portal? I don't seem to see the idea behind disabling this if permissions assigned to each profile anyway.


Also, how come I created an account when I was logged in on the default online registration account and managed to transfer that user to that new account? Yet when that's happened he can no longer create new contacts nor accounts?


This doesn't make sense.


Sites allows you to create and read standard objects (except products, pricebooks, and ideas) to support Web2AnyObject flows


This is for unauthenticated case.


Sites also integrates with customer portal and Partner portal for authenticated access. Registration methods are provided in order to make this integration seamless.


Each portal user has

1- a user

2- an account 

3- a contact under this account and tied to the user


portal users have their own portal license and profile which gives them certain access controls (based on the portal license) and role for sharing



If your use case to create contact anoymously then you can do that with out a portal via sites.

If your use case to create contacts after authentication then you need to tie your site with partner portal because only partner portal allows you to create accounts and contacts. 



Ok, thankyou. This means I will have to scrap using standard objects again.


What I don't understand still is that when I created an Account and transferred the user/contact to that Account, I was authenticated. I can do this again and again and again. It worked. I don't see why it shouldn't work when I want to create a contact for the account the authenticated person is related to!

varsha durgivarsha durgi
You cannot assign a Portal Account or Contact to a Portal user. Please choose a different user. 

This error occurs if the owner of Contact and Account of a Customer Portal User are different. 
José Ureña 1José Ureña 1
I had a lot of errors when trying to enable Customer portal users to edit their account and to create new contacts.

This is what i did to solve the errors, hope this help someone: