1

There is a custome object called CutomObject in my sandbox system. I have created a salesforce community to display these objects.

I have created a sharing set on this object type as follows and granted read/write access.

CustomObject.Account = User.Contact.Account

This works fine so that, When I query all the CustomObjects it only extract relevant records. My lightning web component has a model containing following code to view entire CustomObject. (This model appears on abuttonClick)

<lightning-record-form
    record-id="xxxxxxxxxxx"
    object-api-name="CustomObject__c"
    layout-type="Full"
    mode="readonly"
    columns=2>
</lightning-record-form>

But it is not execute properly. Following error appears.

You don't have access to this record. Ask your administrator for help or to request access. INSUFFICIENT_ACCESS

enter image description here

Please note that this error only appears when I log in as a community user. When I log in as the system admin user this is working fine.

Any clue for this?

  • 1
    Check if you have given objects access and FLS to Community User Profile. AS you are having account lookup on CustomObject you will need Read Access on Account Object and Account Name field. – rahul gawale Nov 7 '19 at 6:46
  • 1
    I found the issue behind this. With my sharing set, the user is granted only access for that set of records. But when I check the object privileges of the user's profile, it was indicated as no access against my CustomObject. Once the read access is granted, the issue was resolved. – Isuru Buddhika Herath Nov 8 '19 at 0:32
0

It seems the user does not have permission to access the particular record type. To enable,

  • Type and profiles in SETUP
  • Then select the profile related to your community.
  • Select Object Settings under Apps
  • Change Object Permissions of CustomObject__c to Read from No Access.

Now you are able to use lightning-record-form.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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