function readOnly(count){ }
Starting November 20, the site will be set to read-only. On December 4, 2023,
forum discussions will move to the Trailblazer Community.
+ Start a Discussion
Manoj BadamManoj Badam 

Need help with component interface

I am using the force:recordId interface in my component which is returning the records id and is there any way i can access subject name in lightning?
Best Answer chosen by Manoj Badam
Raj VakatiRaj Vakati
Do you mean accessing Sobject name also ..  use force:hasSObjectName interface to a Lightning component to enable the component to be assigned the API name of current record’s sObject type. 

Refer this link 

https://developer.salesforce.com/docs/component-library/bundle/force:hasSObjectName/documentation

​​​​​​​
<aura:component implements="force:lightningQuickAction,force:hasSObjectName">

    <!-- ... -->

</aura:component>


The component’s controller can access the ID of the current record from the recordId attribute, using component.get("v.sObjectName"). The recordId attribute is automatically added to the component by the force:hasSObjectName interface.

All Answers

Raj VakatiRaj Vakati
Do you mean accessing Sobject name also ..  use force:hasSObjectName interface to a Lightning component to enable the component to be assigned the API name of current record’s sObject type. 

Refer this link 

https://developer.salesforce.com/docs/component-library/bundle/force:hasSObjectName/documentation

​​​​​​​
<aura:component implements="force:lightningQuickAction,force:hasSObjectName">

    <!-- ... -->

</aura:component>


The component’s controller can access the ID of the current record from the recordId attribute, using component.get("v.sObjectName"). The recordId attribute is automatically added to the component by the force:hasSObjectName interface.
This was selected as the best answer
Manoj BadamManoj Badam
Thanks :+1: