-
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
How to Use Salesforce Marketing Cloud and 15 Surprising Benefits
Salesforce Marketing Cloud provides a variety of tools for creating personalized journeys that are relevant to your audience. This article will explore some of the advantages…
How to Choose the Right Salesforce Consulting Partner for Business Growth
In today's digital-first business landscape, organizations need a CRM platform that can streamline operations, improve customer engagement, and accelerate revenue growth. Salesforce continues to be…
Document Generation in Salesforce with Nintex DocGen via Apex Code
Hello All, Welcome to another part of Nintex Document Generation in salesforce and this gonna be code-based. Before going to dive into it, I request…
Popular Salesforce Videos
Get Together Safely with Salesforce Safety Cloud
Learn how Safety Cloud helps people get together in person, safely. Safety Cloud helps businesses and communities better manage their testing, health and entry protocols…
Attribute Setup for Skill based Routing in Salesforce
This video is 3rd Part of the Omnichannel Series. Implementation of Attribute set up skill-based routing with the demo. Do let us know in the…
Salesforce Lightning Process Builder: Lightning Process Builder Basics
The Salesforce Lightning Process Builder is a new workflow tool that helps anyone in your company quickly and easily automate business processes such as employee…
Popular Salesforce Infographics
4 Reasons To Offer An Exceptional Customer Service
When it comes to customer service, our friends at Salesforce have a few tips and tricks up their sleeve. We were thrilled to help them…
5 Essential Skills for Salesforce Developers
Calling all aspiring Salesforce developers! Conquer the platform with these 5 must-have skills: ✅ Expertise ✅ Coding chops ✅ Problem-solving power ✅ Teamwork & communication…
How To Crack Salesforce Admin Exams with Ease?
The demand for Salesforce Admin professionals is increasing day by day. industries are constantly looking for certified Salesforce Admins. Clearing Salesforce Admin Certification Exams is…