No Code Solution to fetch records between two related objects related using Junction Object with the help of Salesforce Lightning Flows
Step 1: Create a Autolaunched Flow
Step 2: Create a Variable of Resource Type Variable. Provide a relevant API Name to the variable, Description and Data type as Text or any Data type depending on your business use case
Step 3: We fetch all the related Opportunity Records under an Account using the Get Records element. Try to use filters or declare which field values under an Opportunity are relevant to the current context of the process
Step 4: Create a Variable of Resource Type Variable. Provide a relevant API Name to the variable, Description and Data type as Text or any Data type depending on your business use case. Check the Allow multiple values (collection) checkbox
Note: Please be sure to check the above checkbox, as the Flow would then treat the variable as a list/array instead of a simple variable
Step 5: Loop over the records that were retrieved from the previous Get Records element
Step 6: Use an Assignment element inside the loop to store the Opportunity Ids inside the newly created variable using the + operator. This step would append the related Opportunity Id of an Account into the list
Step 7: Use a Get Records element to fetch the related Opportunity records based on the Opportunity Ids in the list variable by using the IN operator. This would make sure that you only fetch related Opportunity Line Items which are related to the Opportunities under the Account
___________________________________________________________________________________________
Written by: Meghesh Shenoy | Forum Ambassdor
Meghesh Shenoy is a Salesforce developer, a Salesforce Forum & Mulesoft Ambassador. He is a Mulesoft and Salesforce Certified Developer, carrying the knowledge of building automation solutions using Salesforce and Mulesoft. Meghesh is passionate about sharing knowledge and experience and also helping others sharpen and grow their Mulesoft & Salesforce skills together.
Submissions reflect only the opinions of the user who made available the Submission and not the opinions of Salesforce, regardless of whether the user is affiliated with Salesforce, and may contain or constitute products, services, information, data, content and other materials made available by or on behalf of third parties ("Third Party Materials). Salesforce neither controls nor endorses, nor is Salesforce responsible for, any Third Party Materials, including their accuracy, validity, timeliness, completeness, reliability, integrity, quality, legality, usefulness or safety, or any applicable intellectual property rights. Any Submissions made available through any message board or forum in response to posted questions, or that otherwise purports to answer any questions, including any questions about Salesforce or Programs, are made available for your general knowledge only and should never be relied upon as answers to your specific questions (even if an answer is marked as a “best” answer or with any similar qualifications). You should always contact Salesforce support for answers to your specific questions. Salesforce has no control over Submissions, and is not responsible for any use or misuse (including any distribution) by any third party of Submissions.
If you have questions, tap into the wisdom of our entire Trailblazer Community here: https://trailhead.salesforce.com/trailblazer-community/feed
004810935

We use three kinds of cookies on our websites: required, functional, and advertising. You can choose whether functional and advertising cookies apply. Click on the different cookie categories to find out more about each category and to change the default settings.
Privacy Statement
Required cookies are necessary for basic website functionality. Some examples include: session cookies needed to transmit the website, authentication cookies, and security cookies.
Functional cookies enhance functions, performance, and services on the website. Some examples include: cookies used to analyze site traffic, cookies used for market research, and cookies used to display advertising that is not directed to a particular individual.
Advertising cookies track activity across websites in order to understand a viewer’s interests, and direct them specific marketing. Some examples include: cookies used for remarketing, or interest-based advertising.