-
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
Creating a Salesforce Extension: From Idea to Listing on Appexchange
With more than 6 million AppExchange installs, it's no wonder that 89% of Fortune 100 companies are using apps from Salesforce's AppExchange to get things done smoothly…
Salesforce Sales Cloud Implementation - All You Need to Know
You’ve decided to use Salesforce, but now what? What do you need to be aware of? What comes out of the box and what will…
Steps To Navigate Within Salesforce Lightning Components
Hi! As we know there is a tag force:navigateToComponent use to navigate within the Salesforce Lightning component. So here we will use this tag to…
Popular Salesforce Videos
Winter 21 - Restrict Access to @AuraEnabled Apex Methods for Authenticated Users
Winter 21 - Restrict Access to @AuraEnabled Apex Methods for Authenticated Users The video explained the following Items: Action items to enable or disable the…
Salesforce Customer 360 Data Manager
Salesforce Customer 360 Data Manager is a cross-cloud integration capability that allows Salesforce admins and developers to combine and reconcile customer data from their Salesforce…
Salesforce Developers Innovate From Anywhere
Hear from Developer Trailblazers to learn how they’ve been innovating from anywhere and making magic happen for their users with Salesforce. With Salesforce, Developers can…
Popular Salesforce Infographics
Salesforce CRM Integration With External Systems
Salesforce integration is one of the most important aspects of Salesforce services. It allows businesses to keep their Salesforce environment up and running. Integration Features…
Introduction to The Salesforce Architecture
Have you ever wondered what is so special about Salesforce? How does it manage to accomplish so much in such less time? Well, the secret…
Choosing the Right Salesforce Partner - Guide
Tips To Hire The Right Salesforce Partner for Growth & Success Salesforce is compact with some of the most exemplary features like no other CRM…