Filter a Dynamic Component on the current record with the Target Page Object and $Component.recordId.

Pass the current record Id from a Lightning page to an Avonni Dynamic Component, so its data follows the page. A short tip for Salesforce admins using Lightning App Builder.
Hello and welcome to this new video tutorial about the dynamic component. So I often get the question about how to really pass the current record ID from a Lightning page to a dynamic component like on this example you see I am on an account page and here I build an a dynamic component to display related information in this case to display related contact based on the account. So how you can really pass the current record ID of the page you're currently viewing to the dynamic component. I will show you that it's very easy, very simple to do. So let's jump right into the Avonni components application. When you create a new Avonni dynamic component like this, it's really important to set a target page object because these settings will let the Avonni dynamic component the context where it operates. For example, if you like to create a data table to display related information that will sit inside an account page, the target page object will be account here. Let's create this. So now I will show you how to use this inside your dynamic component to really make it aware of the context it operates. So let's say I'd like to use a data table to display related contact from an account. So here I will create a query here to get the contact information querying the contact object and because this dynamic component will sit on the account page and because we set the target page name to account you need to filter the information because here for my case I don't want to display all the contacts from my Salesforce. So I need to filter information to only display the contact where the account ID is equal to the map value of the dollar sign component. So that's where the target page object settings you will be able to use this into your dynamic component by selecting dollar sign component. Then you select the record ID and because you set the target page name now the a dynamic component will be able to retrieve the current record ID and use it inside your dynamic component. So with that in place now my query will display relating information from the context where it operates. So that's really to and let's say email. That's it. That's really a quick example regarding the settings and how you can really make sure your dynamic component is aware of the context especially if you want to pass the current record ID on a page and placing this dynamic component into a specific page. At any time you can also click on the settings to change the target page object if you don't need to use this for your dynamic component. So this is it. So this is it for this quick video regarding one specific features of the dynamic component that might help you building your dynamic component with a. Thank you so much and if you have any question feel free to drop your question in the comment section below. Thank you so much for watching. Bye-bye.
Set the Target Page Object when you create the component, then in your query add a condition where the lookup field (Account ID) equals the mapped value $Component, RecordId.
It tells the component the context where it operates, such as an account page, so it can retrieve the current record ID.
Yes, open the component settings and change the Target Page Object.
Browse the whole library, filtered by where it runs and what you want to build.
All video tutorials