1 resposta
Hi, It appears that you are trying to get the record ID primarily using the standard controller anotation in your constructor The force:hasRecordId interface indicates the current record Id should be injected in the component’s recordId attribute so you can define recordId attribute as follows instead of converting your constructor to auraEnabled
<aura:attribute name="recordId" type="Id" />
When the component is instantiated on the page, the current record Id is automatically injected in the recordId attribute. You can then make calls to the server passing the recordId as a parameter to retrieve or save data for that specific record.
Example Code:
Reference: https://developer.salesforce.com/blogs/developer-relations/2015/11/building-context-aware-lightning-components.htmlIf you still intend to convert this auraEnabled, you need to declare a static method. Please see examples in the below documenthttp://developer.salesforce.com/docs/atlas.en-us.lightning.meta/lightning/controllers_server_apex_auraenabled_annotation.htmAnudeepaction.setParams({
"accountId": component.get("v.recordId")
});