0

I am getting the error OP_WITH_INVALID_USER_TYPE_EXCEPTION when trying to create a new Account in Apex Class, i tested both keywords whithout sharing and with sharing, and already added permission to create Accounts in profile, and sharing setting is already setted to Public read/write.

When a verify if this object is creatable with method Account.sObjectType.getDescribe().isAccessible(), the method returns true;

Is there any way around this?

  • Ist your customer user a Chatter Free user? sfdctechie.wordpress.com/2019/02/16/… – Florian Heer May 27 at 15:38
  • Is a customer community user. – vrr May 27 at 15:53
  • And what license is in use: "Customer communtiy plus", "partner community" or "customer communty"? – Florian Heer May 27 at 16:53
  • Just customer community, i read this post and i tried change owner of account with a user that has Standard profile, and works. But it's not the expected behavior of client. Is there way to create with current logged Costomer Community user as Owner? – vrr May 27 at 20:02
1

Obtain your user ID and check if the user has access to the record using the following SOQL query

"SELECT RecordId, HasReadAccess, MaxAccessLevel FROM UserRecordAccess WHERE UserId = [User ID] AND RecordId = [Record ID]"

Tne exception 'OP_WITH_INVALID_USER_TYPE_EXCEPTION' occurs when an attempt is made to insert the record with a user whose license doesn't allow the creation of that record

So the simple solution is to explicitly set the owner of the new record to some fully-licensed user prior to inserting it or ensure he has access to the object/record that is being inserted

| improve this answer | |

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