-
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
Salesforce Introduces the AI Suite Agentforce to Increase Worker Output
Discover how Salesforce is transforming the future of business with Agentforce, a groundbreaking AI solution introduced at Dreamforce 2024. Designed to supercharge productivity across sales,…
What is Field level security in SQL? | The Ultimate Guide
What is Field Level Security in SQL? Field level security in SQL is a feature that allows administrators to control access to specific fields in…
Introduction to Salesforce Experience Cloud
We now live in a fast-moving digital era, where businesses compete for top-notch customer experience on various points of service in operation. In this industry,…
Popular Salesforce Videos
How Big Was Salesforce Dreamforce 21 Park? Take a Walk.
This two-minute walk shows exactly how Salesforce Dreamforce 21 International Park was set up. See for yourself how big it is. Also, share your Dreamforce…
How to Learn Salesforce Development | Salesforce learning steps for beginners | Trailhead demo
In this video, we shared the steps to learn salesforce lightning basics, salesforce apex development, CRM in online for free from scratch very quickly. Learn salesforce…
Salesforce Exam Dumps - Are They Worth It?
In this video, Brad discusses the unethical, yet common, practice of using Exam Dumps to pass a certification exam. These dumps are not only immoral,…
Popular Salesforce Infographics
Why Do Businesses Need Salesforce Development Services?
Businesses today require scalable, automated, and data-driven solutions to stay competitive. By integrating workflows and enhancing customer experiences, they can streamline operations and drive growth…
Average Salesforce Salaries in 2023-2024: What You Need to Know
Salesforce is a popular CRM platform that is used by businesses of all sizes. If you're considering a career in Salesforce, you may be wondering…
The Evolution of Cloud Computing | Salesforce
Cloud computing services have revolutionized the way we store, host, and share information. Most of the consumer services we use in our everyday lives rely…