-
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
Top 5 Feature Updates in Salesforce Spring ‘20 Release
Hello everyone and welcome to 2020! We hope you all enjoyed the holidays and had a nice new year! With a new year brings a…
Introduction on How to Use Workbench | Salesforce Developer Guide
Workbench is a powerful and important platform. It is a web-based suite of tools that help the administrators and developers (Salesforce) to communicate with your…
Popular Salesforce Videos
Best Chrome Extensions for Salesforce
These are the best FREE Chrome Extensions to use with Salesforce. Installing Chrome extensions is the easiest way to enhance your experience on the Salesforce…
After Triggers | Trigger in Salesforce - Part 2
In this video, we are going to look into - After Trigger with Example, Our Scenario is - For After Insert Whenever my account record…
How to Compare Change Sets from Another Org ? #Salesforce Change Sets Helper | Salesforce Tutorials
Change set with sort, view all, and additional information, such as last modified date. Allows comparison with other orgs. A chrome extension to improve the…
Popular Salesforce Infographics
Salesforce Marketing Cloud
Salesforce Marketing Cloud is a platform where relevant and personalized journeys are delivered across different devices and channels. This allows the marketers to deliver right…
Salesforce Experience Cloud Benefits For Business Growth
Explore How Salesforce Experience Cloud Can Help Your Business? Get bespoke solutions including: Data integration, time & cost savings.
How a CRM Platform can Immediately Impact your Business
Selecting the best CRM for small businesses is not a one-size-fits-all endeavor. If you’re new to working with a CRM platform, you often have to…