-
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

Bringing the best of both worlds – AMS 360 Integration with Salesforce
AMS 360 Integration with Salesforce – Insurance is linked with everyone in some way or the other, be it personal insurance, property insurance, automobile insurance,…

Integration of Two Salesforce Org Using REST API - The Complete Guide
What is Integration in Salesforce? Salesforce integration is the process of incorporating the data and functionality of Salesforce with another operation to give druggies a…

Protect your Data with Data Classification in Salesforce
Happy Cybersecurity Awareness Month (CSAM)! Did you know that the loss of critical, and often sensitive, information can severely impact the profitability and innovation of your…
Popular Salesforce Videos
Can a Housewife Make Career in Salesforce?
Wondering if a Housewife can make a career in Salesforce Join this user group for Salesforce job & career info and learn all you need…
Apex Scheduler Part II | Asynchronous Apex | Salesforce Video Tutorial
Asynchronous Apex 1. Apex Scheduler 2. Ways to run apex scheduler 3. Cron Expression 4. Examples Upcoming Video on Batch Apex Hope you guys enjoy…
Send WhatsApp and Save Chat using Lightning Component Salesforce | Salesforce Tutorials
In this video you will learn to send #WhatsApp using Lightning Component Salesforce. Also we will create a custom object to store the chat. Features…
Popular Salesforce Infographics

How to Use Psychology to Target Your Buyer?
Ever wanted to get into the minds of your customers and figure out how they think? Ever wanted to know the best methods to convince…

How IT Leaders Can Build Employee Advocacy | Salesforce Infographic
We created the APAC Employee Engagement report based on this research, to provide key insights that are critical to IT and people leaders now and…

9 Ways Salesforce Brings Companies and Customers Together
As the world’s #1 CRM, Salesforce brings companies and customers together. This is possible through Salesforce Customer 360. It’s an integrated, AI-powered customer relationship management…