I have a requirement to display message toast on detail page when any record is opened. This message will be from a custom field (Alert_Text__c) on Account which is a text field.
Below is the code to display toast message
Lightning component:
<aura:component implements="force:appHostable,flexipage:availableForAllPageTypes">
<div>
<lightning:button label="Information"
variant="brand"
onclick="{!c.showInfo}"/>
</div>
</aura:component>
Javascript:
({
showInfo : function(component, event, helper) {
var toastEvent = $A.get("e.force:showToast");
toastEvent.setParams({
title : 'Info',
message: 'This is an information message.',
duration:' 5000',
key: 'info_alt',
type: 'info',
mode: 'dismissible'
});
toastEvent.fire();
}
})
Now, is there any way to display value of Alert_Text__c as a message when this button is clicked instead of pre-defined message. Please suggest