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
Jeremiah CochranJeremiah Cochran 

is it possible to use the same lightning component on different objects

Is it possible to determine what sobject a lightning component is being used on and store that value in a variable and then pass that variable to an APEX controller so that information is returned for that object?

I have built a lightning component that is used to provide rating information and overall quality evaluation for a custom object, but the same functionality could also be helpful on another object. Do I have to recreate the component for each specific object or is it possible to determine what object is using it?

Secondly, I am considering another approach that would allow a system admin to create a record on a custom object where they specify the object api name and the field api name the component should use, but again I'm not sure how to achieve this. Any help would be greatly appreciated.
sfdcMonkey.comsfdcMonkey.com
Hi Jeremiah Cochran , yes we can create reusable lightning component, first of all let us know where you are using this lightning component ? on detail page of object or somewhere else

Thanks