You need to sign in to do that
Don't have an account?

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
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
Can you try putting debugger statements to see if the flow is correct?
Regards,
Anutej
All Answers
Can you try putting debugger statements to see if the flow is correct?
Regards,
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