0

I have a custom objet related to the account. I want to launch that component from the button or action from the account.

The purpose of the component is to take an account ID and present all of the related records for this account. The component has filters so that the results can be filtered. It also has a related object on the component and displays these related records.

I’m struggling to figure out if this can be done and if so, how.

Thank you!!!

Fred

2
  • 2
    What are you trying to achieve with this component and do you expect to receive account Id or custom Object Id? Please edit your question to provide more clarity Commented Mar 20, 2020 at 2:02
  • Thanks Anmol. I added more info.
    – Frank
    Commented Mar 20, 2020 at 12:51

2 Answers 2

0
  1. Please create a Lightning component with quick action
  2. After clicking the button Get the "recordId" form URL in JS method and pass to server (Apex Controller) and display related records based on that Id

Refer Below stack exchange Posts:

how to get id from url in lightning component?

Calling server side from js side:

https://trailhead.salesforce.com/en/content/learn/modules/lex_dev_lc_basics/lex_dev_lc_basics_server

  1. Write onchange function on Filters.whenever filter changes write dynamic soql query to get the records.

If you still need any information.I will update my answer

0

The answer you seek is at https://developer.salesforce.com/docs/component-library/bundle/force:hasRecordId/documentation Your component markup needs to contain

implements="force:hasRecordId"

which is automatically created if you create a new Lightning Component in the Developer Console and select "Lightning Record Page".

In your component markup you need to declare a recordId attribute:

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

From the controller you can access that with

var accountId = component.get("v.recordId");

So when your Lightning component is called from an Account record, recordId is automatically filled with the Accounts Id.

1
  • Thank you both. It sounds like the id is just there as from the calling record. That is what I was missing as I could not understand how the component would "get" the id. I will run with this. Thank you both!!!!
    – Frank
    Commented Mar 20, 2020 at 13:52

You must log in to answer this question.

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