2

I have a child object "Campaign Child" under the Campaign object. They have a master-detail relationship.

I use lightning:recordEditForm to override the standard "New" button on the "Campaign Child Object". It is located on the "Campaign Child" related list shown on the Campaign Page.

I notice that after a short period of browser inactivity, when the user clicks on that "New" Button, the component opens but doesn't load or yield any error or anything.

Additionally, it seems to randomly give the "Missing required field" error, even though that required field, the Campaign, is filled out. Does anyone have a similar issue?

Here is the cmp

<lightning:layout horizontalAlign="space" verticalAlign="start" multipleRows="true" class="slds-box slds-theme_default"> 
    <!-- Record Create Form -->
    <lightning:recordEditForm aura:id="newCampaignChildForm" objectApiName="CampaignChild__c"
                              onerror="{!c.handleFormError}"> 

        <!-- ERROR MESSAGE -->
         <lightning:messages />

         <!-- BUTTON PANEL -->
         <div class="slds-align_absolute-center"> 
             <lightning:button aura:id="submit" type="submit" label="Generate" class="slds-m-top_medium" />      
         </div>
         <!-- BUTTON PANEL --> 

         <div class="slds-grid slds-wrap slds-gutter slds-m-vertical_medium">
            <div class="slds-col slds-medium-size--1-of-2 slds-p-horizontal_medium slds-p-vertical--xx-small slds-small-size_1-of-2">
                <lightning:inputField aura:id="input_Offer_Type__c" fieldName="Offer_Type__c" onchange="{!c.handleOfferTypeChange}"/>
            </div>

            <div class="slds-col slds-medium-size--1-of-2 slds-p-horizontal_medium slds-p-vertical--xx-small slds-small-size_1-of-2">
                <lightning:inputField aura:id="campaign_name__c" fieldName="campaign_name__c" />
            </div>
         </div>
    </lightning:recordEditForm> 
</lightning:layout>        

Here is controller ({ handleOfferTypeChange : function(component, event, helper) { console.log('offer type changed'); }, handleFormError : function(component, event, helper){ console.log('ERROR: ' + JSON.stringify(event.getParams().error)); } })

Here is error message ERROR: {"message":"An error occurred while trying to update the record. Please try again.","stackTrace":"","data":{"message":"An error occurred while trying to update the record. Please try again.","statusCode":400,"enhancedErrorType":"RecordError","output":{"errors":[],"fieldErrors":{"campaign_name__c":[{"constituentField":null,"duplicateRecordError":null,"errorCode":"REQUIRED_FIELD_MISSING","field":"campaign_name__c","fieldLabel":"Campaign Name","message":"Required fields are missing: [campaign_name__c]"}]}}},"id":"347921212"}

enter image description here

  • Some minimal code to try and reproduce this would be helpful. Could you edit in some code? – sfdcfox May 7 '18 at 4:26
  • Hi sfdcfox, I added my code here. Somehow When I try to replicated the same code in my dev org it doesn't show the error. Seems to occur in sandbox only and at random times. – Uyen May 8 '18 at 23:37

Your Answer

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

Browse other questions tagged or ask your own question.