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
Sowmya YakkalaSowmya Yakkala 

How to insert record in Account Object in Community

Hi,
I am able to insert Record in Account Object in Lightning. But i am not able to insert Record in Community.And getting Error like
Insert failed. First exception on row 0; first error: OP_WITH_INVALID_USER_TYPE_EXCEPTION, Operation not valid for this user type

And For that i had written Apex Class Below
@AuraEnabled
    Public Static Account createAccountRecord(Account newAccountdata) {
        if(newAccountdata !=null){
            newAccountdata.ownerId = UserInfo.getUserId();
            insert newAccountdata;
            System.debug('newAccountdata--'+newAccountdata);
        }
        return newAccountdata;
    }
Can anyone help me....
 
Vinay MVinay M

Hi Soumya,
 
  Make sure that the Apex class is added to the profile which will be accessing the community, and also check settings for "Account" object under that profile. Enable "Create" if that is already not done.