I have a requirement to build a custom component for Customer Community to create a new case. On the form I have a lookup field to a custom object that doesn't want to work. Are lookups to custom objects suppose to work in communities? Here's a simplified version of my code.

<aura:component implements="force:appHostable,flexipage:availableForAllPageTypes,flexipage:availableForRecordHome,force:hasRecordId,forceCommunity:availableForAllPageTypes,force:lightningQuickAction" access="global" >
<aura:attribute name="Case" type="Case"  />
<aura:attribute name="newCase" type="Object"  />
<aura:attribute name="simpleNewCase" type="Object" />
<aura:attribute name="newCaseError" type="String" />
<force:recordData aura:id="caseRecordCreator"
                  targetError="{!v.newCaseError}" />

<!-- First we initialize the form -->
<aura:handler name="init" value="{!this}" action="{!c.doInit}" />

<lightning:recordEditForm objectApiName="Case"
                          onsubmit="{!c.handleSaveCase}" >
                        <lightning:inputField fieldName="Location__c" />
                        <lightning:inputField fieldName="OwnerId" />
                        <lightning:inputField fieldName="LocationTest__c" />
                        <lightning:inputField fieldName="ContactId" />
                        <lightning:input label="Input" value="{!v.case.LocationTest__c}"/>


doInit : function(component, event, helper) {
    //Standard way to load a record template using Lightning Data Service
            var rec = component.get("v.newCase");
            var error = component.get("v.newCaseError");
            if(error || (rec === null)){
                console.log("Error initializing record template: " + error);
                console.log("Record template initialized" + rec.sobjectType);

    handleSaveCase : function(component, event, helper){
    //This is how we link the new Contact with the actual Account Id
    //component.set("v.simpleNewCase.AccountId", component.get("v.simpleUser.AccountId"));        
    //component.set("v.simpleNewCase.ContactId", component.get("v.simpleUser.ContactId"));

    //Standard way to save a record using Lightning Data Service
        if(saveResult.state === "SUCCESS" || saveResult.state === "DRAFT"){
            //resultToast is a pop-up window that show messages.
            var resultsToast = $A.get("e.force:showToast");
                "title" : "Case saved",
                "message" : "The new case was created",
                "type" : "success"

        }else if(saveResult.state === "INCOMPLETE"){
            console.log("User is offline, device doesn't support drafts.");
        }else if(saveResult.state === "ERROR"){
            console.log("Problem saving case, error" + JSON.stringify(saveResult.error));
            console.log("Unknown problem, state: " + saveResult.state + ', error: ' + JSON.stringify(saveResult.error));

Why isn't the Location lookup showing any values?

  • which field is the lookup? and what do you mean by doesnt work? when you search on it for existing records, none populate?
    – glls
    Mar 23, 2019 at 17:03
  • Location__c and LocationTest__c don't even show up on the UI as if that code was commented out or something. Mar 23, 2019 at 17:25

1 Answer 1


I fixed the issue by giving the community user profile read/edit rights to the Location Object

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .