Display another record's album on a page record using a Flow (Admin-friendly)
This article demonstrates how to display another record's album on a page record of an object using Flow. To do so we will:
- Setup the Lookup relationship between the required objects
- Create the Flow
- Add the Flow onto the desired page record
Setup of the Lookup relationship
In order to add another record's album onto your page record, you need to access the other record's ID. This ID will then be used as the album ID inside the Flow.
One easy way to obtain the related record's ID is to create a Lookup relationship field to the related record. For example, if you intend to display the album of Object1 onto the page record of Object2, you can create a Lookup relation to Object1 on Object2 so as to obtain Object1's record ID.
For simplicity of this demo, we will use the Account object and the Opportunity object as the Opportunity object already has a Lookup relation to the Account object by default.
Creation of the Flow
To create the Flow, follow the steps below:
- Go to Setup then type Flow in the Quick Find box. Under Process Automation, select Flows.
- Click on New Flow. You will be then directed to the Flow Designer.
- Click on Screen Flow, then Create.
- Go on the Manager tab then click on New Resource. Fill the fields as indicated below:
- Resource Type: Variable
- API Name: recordId
- Data Type: Text
- Availability Outside the Flow: Available for input
- Click Done
- Next, go to the Elements tab then drag and drop the Get Records element found under the Data section onto the blank canvas. Fill the fields as indicated below:
- Label: getOpportunityRecord
- Object: Opportunity
- Conditions: Id (Field) Equals (operator) {!recordId} (that is, the newly-created resource named recordId)
- In the How Many Records to Store, check the Only the first record option
- In the How to Store Record Data, check the Automatically store all fields option
- Click on Done
- Click Done.
- Go to the Elements tab and drag and drop a Screen element next to the Get Records element.
- For the Screen element, do the following configurations:
- For the field Label, enter Account Album.
- For this demo, we do not need to display the Flow's header and footer. Therefore, you can uncheck the checkboxes for Show Header and Show Footer under the section named Configure Frame.
- Next, drag and drop the SharinPix Album component onto he screen canvas as demonstrated below:
- Next, click on the SharinPix Album component on the screen canvas to access it's property on the right-hand side panel.
- On the same panel, configure the SharinPix Album's properties as follows:
- API Name: getAccountAlbum
- AlbumId: {!getOpportunityRecord.Account.Id}
Note: The value, {!getOpportunityRecord.Account.Id}, points to the Id of the related Account.
- Click Done.
- Connect the elements as shown below.
Addition of the Flow on the page record
This section demonstrates how to add the newly-created flow on the Opportunity page record. To do so, follow the steps below:
- Go to an Opportunity record, then open the Lightning App Builder.
- Drag and drop a Flow component onto the page layout where desired.
- On the Flow component's properties, select Account Album as value for the field named Flow.
- Click on Save when done.
The related Account album is now available on the Opportunity page record!
0 Comments
Add your comment