1

I just refreshed my dev sandbox and my staging sandbox. In my dev, lightning data service is able to load the record. When I go into my staging environment, which is a partial copy sandbox, no record will load, I will get the ERRROR changeType in my handlePrescription.

Component

<aura:component implements="flexipage:availableForRecordHome,force:hasRecordId" controller="CallerAppController">

    <aura:attribute name="prescription" type="Case" />


    <force:recordData aura:id="prescriptionEditor" 
                      recordId="{!v.recordId}" 
                      targetFields="{!v.prescription}" 
                      fields="Id,CaseNumber"
                      mode="EDIT" 
                      recordUpdated="{!c.handlePrescription}" />

</aura:component>

Controller.js

handlePrescription: function(component, event, helper) {

    console.log(component.get("v.recordId")); // returns an id
    let prescription = component.get("v.prescription");
    let eventParams = event.getParams();
    console.log(eventParams.changeType);
    if(eventParams.changeType === "ERROR") {
        //helper.reload(component);
    } else if(eventParams.changeType === "LOADED") {            
        //console.log("Prescription has loaded successfully.");
        //console.log(JSON.parse(JSON.stringify(prescription)));

    } else if(eventParams.changeType === "CHANGED") {

    } else if(eventParams.changeType === "REMOVED") {
        // record is deleted
        //console.log("Record was removed.");
    }
},

How can I debug this?

16
  • are you able to view that record in SOQL , and classic UI? Jan 30, 2019 at 19:12
  • Yes. I'm also able to view the record in the standard UI.
    – Tyler Zika
    Jan 30, 2019 at 19:13
  • 1
    can you post the error verbatim? Also is it Spring 19 or Winter 19? Jan 30, 2019 at 19:13
  • Have you checked the profile permissions?
    – Robs
    Jan 30, 2019 at 19:14
  • 1
    @TylerZika I tried your code and it works in Spring 19 and Winter 19, without any issue. Can you just remove the apex controller and see if it works.. Jan 30, 2019 at 20:00

1 Answer 1

1

I don't know if this is, but in refreshing my partial sandbox, I forgot to activate it. Once activated, Lightning Data Service started working...

You must log in to answer this question.

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