-
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 Benefits of Integrating a Salesforce Customer Portal for Seamless Self-Service
Customer service has changed dramatically in the last few years. The current customers do not have to wait in a long call line, make numerous…
What are Managed & Unmanaged Packages in Salesforce in 2023?
Salesforce is one of the most widely used Customer Relationship Management (CRM) tools in the world. It provides a platform for organizations to build, customize,…
How to Display a Bar Chart using Visualforce and Apex of Daily API Request in Salesforce Org?
Introduction Visualforce is a web development framework that enables developers to build sophisticated, custom user interfaces for mobile and desktop apps that can be hosted…
Popular Salesforce Videos
What is Dreamforce? | Salesforce Explained
Dreamforce has been coined “the world’s largest tech conference” and is a massive streaming moment on Salesforce+, but what actually takes place at this iconic…
Getting Started With The Ant Migration Tool in Salesforce
Ant Migration Tool In Salesforce. In this video, the following points will be covered - 1. Introduction Get a brief introduction about the Ant Migration…
Salesforce Einstein Search
Salesforce Einstein Search makes your users more productive by bringing the power of Einstein and AI to Salesforce Search. Einstein Search is Personal, Natural, and…
Popular Salesforce Infographics
Enjoy the Salesforce Innovation Management infographic
Without innovation, a company will stay in one place. Without getting ideas from those closest to your product or service - customers, employees, and partners…
Salesforce Marketing Automation: Sales or Marketing Tool? [infographic]
Marketing automation has a hidden talent. Despite being marketed for years as a tool for, well, marketers, automation is changing the shape of the modern…
Enhance Business Capabilities With Expert Salesforce AppExchange Development Services
Unlock the true potential of Salesforce AppExchange by hiring Concretio's expert and experienced team of developers. Leverage the power of AppExchange to empower your business.