Error Debugging – Permission Issue

Recently, we noticed an error in our salesforce org

You do not have the level of access necessary to perform the operation you requested. Please contact the owner of the record or your administrator if access is necessary

From the initial look, it appears to be some permission of access related issue. On deeper dive, this could have occurred because of various reasons.

  1. OWD is very restrictive and does not let the user access the data
  2. Profile does not have required access to this object. BTW, this is Contact data that we are (not) seeing here.
  3. The code ( lightning component ) could have any code block which does not work well.

After debugging a little, OWD for Account/Contact was Public Read only, and we could not change it

Instructor ( custom ) profile has read for Contact and we could not change it.

The lightning component was using, although there was no usecase of editing the contact record

   <lightning:recordEditForm recordId="{!v.instructorData.Id}"
                                              objectApiName="Contact"
                                                                                       class="slds-p-around_x-small">
                      
                        <lightning:outputField fieldName="Name" variant="label-inline"/>
                       
                        <lightning:outputField fieldName="Phone" variant="label-inline"/>
                        <lightning:outputField fieldName="HomePhone" variant="label-inline"/>
                        <lightning:outputField fieldName="Email" variant="label-inline"/>
                        <lightning:outputField fieldName="MailingAddress" variant="label-inline"/>

                      
                    </lightning:recordEditForm>

Once I replaced,

lightning:recordEditForm with lightning:recordViewForm, the page started showing up as needed

Permanent link to this article: https://salesforcebuddy.com/2020/09/error-debugging-permission-issue/

Leave a Reply

Your email address will not be published.