-
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
Strategies To Increase User Adoption For Salesforce
Salesforce is an amazing CRM solution that offers solutions to almost every business function. Due to its highly customizable features, it is important to provide…
Industry Best Practices to Implement Salesforce Marketing Cloud
The Salesforce Marketing Cloud is a sophisticated technology developed by Salesforce that automates the marketing of a business across a variety of channels, including but…
Salesforce and Google Expand their Partnership
Google Workspace and Salesforce announced a partnership extension. Companies are going to enhance their AI capabilities. Salesforce and Google announced their teaming up at the…
Popular Salesforce Videos
Integrating System with Salesforce Commerce Cloud
Designed for retail as well as eCommerce, Salesforce Commerce Cloud has become the best solution for delivering the ultimate shopping experience to the customers. By…
5 Tips: How Events Can Help You Drive Value for Your Business | Salesforce on Salesforce
Events are at the heart of every major launch moment and announcement. They offer opportunities to connect with customers, providing experiences that grow loyalty. And…
How to Enable the New Pardot Email Builder | Salesforce Pardot
Learn how to set up the new Email Builder for Pardot and set up Salesforce CMS for email content storage. Watch this video and do…
Popular Salesforce Infographics
5 Advantages of Using The Salesforce Data Migration Tool in Your Organization
Advantages Of Using The Salesforce CRM Data Migration Services In Your Company are: Fast migration process Repetitive deployment Suitable for both novice and advanced Salesforce…
5 steps to follow for successful Salesforce Implementation
Although implementing Salesforce is designed to help you meet the challenges of your business, it might not provide the results you want, whether it is…
The 6 Greatest Benefits of CRM Platforms | Salesforce CRM
A CRM platform helps companies target different audiences, set scores and alerts based on an individual lead or customer’s activity, proactively work with contacts and…