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?

  • are you able to view that record in SOQL , and classic UI? – Pranay Jaiswal Jan 30 '19 at 19:12
  • Yes. I'm also able to view the record in the standard UI. – Tyler Zika Jan 30 '19 at 19:13
  • 1
    can you post the error verbatim? Also is it Spring 19 or Winter 19? – Pranay Jaiswal Jan 30 '19 at 19:13
  • Have you checked the profile permissions? – Robs Jan 30 '19 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.. – Pranay Jaiswal Jan 30 '19 at 20:00
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...

| improve this answer | |

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.