I'm developing a lightning component which should appear in 3 different object layouts: Account, Opportunity and custom object (which has a lookup to account).

I know I can use the force:hasRecordId and force:hasSObjectName but I wonder if there's a better way to do that.

What is the best way to implement it ?

1 Answer 1


You have to take Object-Agnostic approach while building this Lightning component. There is a complete Trailhead module on this describing the approach.

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .