-
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

How to Use Salesforce Lightning Data Services
INTRODUCTION Lightning Data Service is a Lightning Component which behaves like a VisualForce Standard Controller in VisualForce Page to provide access to Database to display…

How To Create A Lightning Web Component | The Salesforce Developer Guide
For this, you first need to have Visual Studio Code in your system. If you don’t have that then first install it. After that, you…

Salesforce - Hubspot Integration #1: Setup Salesforce Integration with Hubspot
Setup Salesforce Integration with Hubspot You might have came across various Salesforce integration with different third party tools to widen the business with more customers…
Popular Salesforce Videos
Security for Salesforce Developers: Data Security
In this series, we review the most important concepts that developers must understand to create secure applications on the Salesforce platform. We talk about data…
Marc Benioff talks Salesforce - AT&T deal, office health safety and online media regulation
Salesforce’s Customer 360 will enable AT&T to deliver highly-tailored customer experiences seamlessly across retail, marketing, online, business, and more. AT&T will utilize Salesforce’s entire portfolio…
What is Data Management in Salesforce Admin?
Data Loader is a tool to process bulk records and we can process five million records with the data loader.
Popular Salesforce Infographics

4 Ways to Generate Leads Using Marketing Automation
As businesses gain access to greater amounts of customer data, and consumers themselves have more options for services and products, marketing strategies have become more…

The Deluge of Data — And What to Do With It
Data is defined as “facts and statistics collected together for reference or analysis,” and it is everywhere. It comes from transactions, industrial equipment, apps, sensors,…

Why You Should Know About Order to Cash Process - Step by Step | Salesforce Guide
The order-to-cash (O2C) process is a defining part of a company’s success, and it also plays a big role in driving an organization’s relationship with…