1

I have a community and I am developing a lightning component page to display a custom object record Grant__c in this community.

The custom object Grant__c is in Private sharing mode so only owners can see records, and I have added a sharing set in the community settings, to allow a user to view/edit all of it's parents account Grant__c records.

The problem happens when I use in my components inside the community, I can view and and edit the Grant__c record that I own, but cannot view or edit the Grant__c record that I do not own. I get this error on the recordUpdated event:

Error: We couldn't find the record you're trying to access. It may have been deleted by another user, or there may have been a system error. Ask your administrator for help.

This is the relevant code:

MARKUP:

<aura:component implements="force:appHostable,forceCommunity:availableForAllPageTypes">

    <aura:attribute name="fields" type="String[]" description="API field names of the grant" default="Id,Name,Website__c" />
    <aura:attribute name="recordId" type="String" description="Id of the current record" />
    <aura:attribute name="recordError" type="String" description="An error message bound to force:recordData"/>
    <aura:attribute name="record" type="YH_Grant__c" description="data of this grant" />

    <force:recordData aura:id="recordEditor"
                      fields="{!v.fields}"
                      recordId="{!v.recordId}"
                      targetError="{!v.recordError}"
                      targetFields="{!v.record}"
                      mode="EDIT"
                      recordUpdated="{!c.recordUpdated}"/>

</aura:component>

CONTROLLER:

recordUpdated: function(component, event, helper) {

    var changeType = event.getParams().changeType;

    if(changeType === "LOADED") {
        console.log("LOADED!!!");
    } 
    else if(changeType === "ERROR") {
        // here I get this error 
        console.log('Error: ' + component.get("v.recordError"));
    }
},

This is the sharing set definition:

enter image description here

QUESTION

Why don't I see records that I do not own, although my parent account and their parent account are the same?

0

Try Setting the access mapping to:

User:Contact.Account = Grant:Account

May be this can help.

  • Thank you for the idea, but it does not work – Itai Shmida Jul 5 '18 at 11:19

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.