You need to sign in to do that
Don't have an account?
Tamilselvan chinnasamy
salesforce Button label
How to change the name of the button label as record changes? dynamically... ? If type is prospect, then button label should change to prospect. How to do that?
****component:****
<aura:component implements="flexipage:availableForRecordHome,force:hasRecordId" controller ="DynamicButton" access="global" >
<aura:attribute name="buttonName" type="string" default = "Test"/>
<aura:handler name="init" value="{!this}" action="{!c.doretrive}" />
<div class="slds-box slds-theme_default">
<h1> Account type </h1>
<lightning:button label= "{!v.buttonName}" />
</div>
</aura:component>
and
*****controller:********
({
doretrive : function(component, event, helper) {
var action = component.get("c.dispbutton");
action.setParams({'recordId':component.get('v.recordId')});
action.setCallback(this,function(data){
component.set('v.buttomnName',data.getReturnValue())
});
$A.enqueueAction(action);
}
})
return the value in the disbutton method .
thankyou
All Answers
Have you checked this link for similar use case?
https://salesforce.stackexchange.com/questions/38521/how-to-change-label-on-custom-button-based-on-value-in-the-record-being-displaye
https://www.forcetalks.com/salesforce-topic/how-to-change-label-on-custom-button-based-on-value-in-the-record-being-displayed/
If it helps mark it as best answer.
Thanks!
Greetings!
You can change the label of the lightning button.
<lightning:button variant="brand" label="{!buttonLabel}" title="Brand action" onclick="{! c.handleClick }" />
change buttonLabel value which you want.
If you find your Solution then mark this as the best answer.
Thank you!
Regards,
Suraj Tripathi
****component:****
<aura:component implements="flexipage:availableForRecordHome,force:hasRecordId" controller ="DynamicButton" access="global" >
<aura:attribute name="buttonName" type="string" default = "Test"/>
<aura:handler name="init" value="{!this}" action="{!c.doretrive}" />
<div class="slds-box slds-theme_default">
<h1> Account type </h1>
<lightning:button label= "{!v.buttonName}" />
</div>
</aura:component>
and
*****controller:********
({
doretrive : function(component, event, helper) {
var action = component.get("c.dispbutton");
action.setParams({'recordId':component.get('v.recordId')});
action.setCallback(this,function(data){
component.set('v.buttomnName',data.getReturnValue())
});
$A.enqueueAction(action);
}
})
return the value in the disbutton method .
thankyou