-
What is the pass Id of current record to Salesforce Apex Controller?
I'm working on a Visualforce Email Template which will be sent from the parent Loan (LLC_BI__Loan__c) record in Salesforce, and I'm trying to include fields from the child Entity Involvement (LLC_BI__Legal_Entities__c) record(s).
I'm attempting to pass the Loan record ID into the Controller using the ApexPages.StandardSetController method, but I think it may be failing due to the fact that the Visualforce component is being used in the email template and not on a record page.
I'm unable to pass the correct parent (Loan) Id to get the correct child records. Can anyone see where I may be going wrong ?
Thank you in advance.
Component: <apex:component controller="BorrowerRecordsFromLoans" access="global"> <apex:attribute name="currentRecordId" description="" assignTo="{!loanId}" type="Id"/> <apex:dataTable value="{!borrowerList}" var="borrower"> <apex:column > <apex:facet name="header">Borrower Name</apex:facet> {!borrower.LLC_BI__Account__r.Name} </apex:column> </apex:dataTable> </apex:component>Controller: public class BorrowersOnLoans { public Id loanId {get;set;} private final LLC_BI__Loan__c loan; public BorrowersOnLoans (ApexPages.StandardSetController controller) { loan = (LLC_BI__Loan__c) controller.getRecord(); } public List<LLC_BI__Legal_Entities__c> getrelatedBorrowers() { List <LLC_BI__Legal_Entities__c> conList = New List<LLC_BI__Legal_Entities__c>(); for(LLC_BI__Loan__c ln: [SELECT id,name, (SELECT id, LLC_BI__Borrower_Type__c, LLC_BI__Account__r.Name FROM LLC_BI__Legal_Entities__r) FROM LLC_BI__Loan__c WHERE id = :loanId]) { for(LLC_BI__Legal_Entities__c con:ln.LLC_BI__Legal_Entities__r) conList.add(con); } return conList; } }
Log In to reply.
Popular Salesforce Blogs
Salesforce Winter '23 Flow Updates
With the Winter ’23 release, there have been a host of improvements and exciting new features with Salesforce Flow, all delivered to make building Flows…
How Real Estate Firms Are Building B2B/B2C Portals Using Salesforce Experience Cloud
Real estate firms cut administrative time by 30% when they build B2B and B2C portals using a Salesforce Development Company and Cloud infrastructure. Tenant satisfaction…
Making Salesforce Documentation a Habit
Let’s talk about an essential aspect of Salesforce that often gets overlooked: documentation. Salesforce has transformed customer relationship management for businesses everywhere, but without proper documentation, Salesforce…
Popular Salesforce Videos
BradForce Interview with special guest Jason Jung | Landing Your First Salesforce Job
In this video, I have a great conversation with Jason Jung. Jason landed his first Salesforce Job in the middle of a global pandemic. Listen…
5 Facts You Didn't Know About Salesforce
In this video, we have tried to share some amazing facts about Salesforce, the world leader in CRM, that you didn't know about so that…
Create a LinkedIn Page like a Salesforce Professional
In this first video of our series "How to Find a Job as a Salesforce Professional", Brad discusses how to create and modify your outdated…
Popular Salesforce Infographics
Salesforce CPQ Services & Processes: InfoDrive Solutions
Simplify your CPQ processes with InfoDrive Solutions Salesforce CPQ services. Work flexibly from any location, on any device, enhancing productivity and increasing deal-closure chances for…
Boost Sales and Marketing with Salesforce Einstein 1
Salesforce Einstein 1 is a suite of artificial intelligence (AI) tools designed to enhance business efficiency and decision-making. Around 80% of customers expect companies to…
Salesforce – The Future of Digital Transformation | An Infographic
Salesforce has been coined as the world’s top CRM company and customer company. It has been soaring high in the clouds, so let’s brush through…