-
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

Changes to the Salesforce Developer Exam: All you need to know
As many of you may be aware, Salesforce.com has announced changes to the Salesforce Developer Certification roadmap: this article offers a detailed Salesforce Developer exam guide on the…

Smarter business with the AI-powered data scientist, Einstein Discovery
In this highly competitive market, organizations are constantly trying to analyze their data and make informed decisions to outrun their competitors. That is where data…

Order of Execution in Salesforce - An Explanation
At the point when you spare a record with an addition, update, or upsert articulation, Salesforce plays out the accompanying occasions altogether. Before Salesforce executes…
Popular Salesforce Videos
Lightning Flow – Release Readiness LIVE, Summer '20 | Salesforce
Watch this amazing video & join the Product Managers to see how you can build flows and processes more efficiently with enhancements to Flow Builder,…
Learn About How to Set Profiles in Salesforce?
Learn about Profiles in Salesforce and types of profiles, Standard and Custom Profiles. Watch this video and do let us know in the comment section…
Introduction to Salesforce OmniStudio | Salesforce Industries
Introduction to Salesforce OmniStudio: The Salesforce OmniStudio digital engagement suite makes it easy to click-configure rich, consumer-grade user experiences based on objects, APEX classes, REST…
Popular Salesforce Infographics

Sales Productivity: Tips to Overcome Productivity Challenges
Growing sales is the cornerstone of business success. Whether you're a startup or an established enterprise, the objective remains the same: Increase Revenue, Expand your…

How to Choose the Right Salesforce Partner | Infographic
Choosing the right partner is a key factor that can make or break the success of your project. Salesforce is a powerful CRM platform, which…

How Can You Become a Salesforce Admin?
Sometimes a piece of technology seems to be used at every company. Knowing how to use that technology can help a person’s career. It can…