function readOnly(count){ }
Starting November 20, the site will be set to read-only. On December 4, 2023,
forum discussions will move to the Trailblazer Community.
+ Start a Discussion
Eric Blaxton 11Eric Blaxton 11 

Aura component question. Action 'Add' button disappears when click 'Cancel' button

Hi and thanks in advance for any pointers here.

Issue:  I created an Action button on the CASE object that calls a Lightning component.  When I click on the Add button, then click the Cancel button, the Add button is no longer there.  I have to click on another tab and then go back to the Case and then the Add button is there.

My component:
<aura:component controller="newCheckRequest" implements="force:lightningQuickActionWithoutHeader,force:hasRecordId,force:appHostable,flexipage:availableForAllPageTypes" >
    <!--This controls the display of the New Check Request action screen, before the New CR screen.  It supresses it.   -->
    <aura:html tag="style">
        .slds-backdrop {
        background: rgba(43, 40, 38, 0) !important;  
        }
      <!--  .slds-fade-in-open {
        display:none !important;-->
        
    </aura:html>  
    <aura:attribute name="cre" type="Check_Request__c"/>     
    <aura:handler name="init" value="{!this}" action="{!c.doInit}" />
</aura:component>

My Controller:
({
    doInit : function(component, event, helper)
    {
       var action = component.get("c.getCase");
       action.setParams({"caseId": component.get("v.recordId")});
       action.setCallback(this, function(response)
       {
        var state = response.getState();
    
       if(component.isValid() && state === "SUCCESS") 
        {
        var  cre = response.getReturnValue();        
                 
            // create method in helper class
            // Putting RT first changes header of the pop up
            var createCrEvent = $A.get("e.force:createRecord");
            var crid=component.get("v.recordId");
            console.log('cre-'+cre);
            createCrEvent.setParams
             ({
                "entityApiName": "Check_Request__c",
                "defaultFieldValues":
                {
                    'Check_RequestRelTo__c' : cre.Id
                  
                }
              });
            createCrEvent.fire(); 
        }
                         
});          
       
     $A.enqueueAction(action);
      // $A.get("e.force:closeQuickAction").fire();
    }        
})

My Helper class: Not really needed, but maybe in the future
({
 toastMessage : function(msg) 
    {
        var toastEvent = $A.get("e.force:showToast");
        toastEvent.setParams
        ({
            title : 'Warning',
            message: msg,
            duration:' 5000',
            key: 'info_alt',
            type: 'error',
            mode: 'dismissible'
        });
        toastEvent.fire();
 }
})

My Apex class: to get the record id

public with sharing class newCheckRequest
{
 @AuraEnabled
    public static Case getCase(Id caseId) 
    {
        //Query fields from Parent record to prepopulate New CheckRequest
        return [SELECT Id,CaseNumber FROM Case where id = :caseId];     
    }
}

Thanks,
Eric
Best Answer chosen by Eric Blaxton 11
ANUTEJANUTEJ (Salesforce Developers) 
Hi Eric,

Can you try putting debugger statements to see if the flow is correct?

Regards,
Anutej

All Answers

ANUTEJANUTEJ (Salesforce Developers) 
Hi Eric,

Can you try putting debugger statements to see if the flow is correct?

Regards,
Anutej
This was selected as the best answer
Eric Blaxton 11Eric Blaxton 11
Hi Anutej,

Please clarify test to see 'if the flow is correct'.

I have some debug statements to see my variables.  They are correct.

Regards,
Eric