Is there anywhere to query data and depend on objects that lighting component display? Let me explain my requirement.

  1. there are 2 objects that was using same my lighting component that i want to create
  2. one object, i want to query by where objecta__c= RecordID and another, i want to query by where accountID=recordID

Is it possible to using only one component to solve this or i have to created one component for one object?

One more question, can I get object type via getting param, something like getting record type?

1 Answer 1


Your component can implement the force:hasSObjectName interface. This will add the attribute

<aura:attribute name="sObjectName" type="String" />

to your component, which will receive the API name of the sObject whose record detail page the component is shown upon, in the same way that you would receive a record Id.

Your component's client-side controller can then decide to render different elements or dispatch different server actions. You can also pass the sObject name to the server controller so that it can perform dynamic SOQL.

You must log in to answer this question.

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