Hi ,
Here we have requirement to get record type id from lightning component when standard "New" action is overrided.
To get selected RecordTypeId from the component we have to implement the lightning interface "lightning:isUrlAddressable" which will be useful to access parameter "RecordTypeId" from the top level.
Eg:
Ligthtning Component:
----------------------------
<aura:component implements="lightning:isUrlAddressable" description="c:helloTarget component">
<aura:attribute name="firstname" type="String" />
<aura:handler name="init" value="{!this}" action="{!c.init}"/>
Hello {!v.firstname}.
</aura:component>
JavascriptController:
-------------------------
({
init: function(cmp, evt, helper) {
var myPageRef = cmp.get("v.pageReference");
var firstname = myPageRef.state.RecordTypeId;
cmp.set("v.firstname", firstname);
}
})
References:
---------------
https://developer.salesforce.com/docs/component-library/bundle/lightning:isUrlAddressable/documentation
Here we have requirement to get record type id from lightning component when standard "New" action is overrided.
To get selected RecordTypeId from the component we have to implement the lightning interface "lightning:isUrlAddressable" which will be useful to access parameter "RecordTypeId" from the top level.
Eg:
Ligthtning Component:
----------------------------
<aura:component implements="lightning:isUrlAddressable" description="c:helloTarget component">
<aura:attribute name="firstname" type="String" />
<aura:handler name="init" value="{!this}" action="{!c.init}"/>
Hello {!v.firstname}.
</aura:component>
JavascriptController:
-------------------------
({
init: function(cmp, evt, helper) {
var myPageRef = cmp.get("v.pageReference");
var firstname = myPageRef.state.RecordTypeId;
cmp.set("v.firstname", firstname);
}
})
References:
---------------
https://developer.salesforce.com/docs/component-library/bundle/lightning:isUrlAddressable/documentation
No comments:
Post a Comment