When Customer Community Users are trying to create a contact, they are facing an error:

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

This is not a licence limitation as I have checked that already:

I think it is a bug that does not allow external users to be owners. But when I tried to update the Owner to an internal user before insert using trigger as well as using workflow, still I faced the same error.

Is there any way to circumvent this?

1 Answer 1


Yes, the system acts inconsistently. Customer Community users cannot create contacts due to the ownership issue, but Customer Community Plus users can create contacts because the system automatically changes the contact owner to that of the portal account owner.

A before insert trigger does work to change the contact owner and allow the contact creation to occur for Customer Community license users. This code worked for me:


trigger ContactTriggers on Contact (before insert) {
    // Change ownership if created by Customer Community.

Handler class:

public with sharing class ContactDomain {
    public static void setOwner(List<Contact> newList) {
        if (UserInfo.getUserType() == 'CSPLitePortal') {
            Id theOwnerId;

            // Use the portal account owner if active, otherwise get a random active standard user.
            User u = [SELECT Account.OwnerId, Account.Owner.IsActive FROM User WHERE Id = :UserInfo.getUserId()];
            if (u.Account.Owner.IsActive) {
                theOwnerId = u.Account.OwnerId;
            } else {
                List<User> users = [SELECT Id FROM User WHERE IsActive = true AND UserType = 'Standard' LIMIT 1];
                if (!users.isEmpty()) {
                    theOwnerId = users[0].Id;

            if (theOwnerId == null) {
                // Throw exception here.

            for (Contact con : newList) {
                con.OwnerId = theOwnerId;
  • Is there a solution that works for visual flows? Commented Jun 12, 2020 at 20:24
  • You could try the new before-save Flow functionality coming soon in the Summer 20 release. Commented Jun 12, 2020 at 23:43

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .