-
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
10 Ways to Enhance Your Buyer Experience with Quote-to-Cash Solutions | Salesforce Guide
When you have hundreds or thousands of leads to respond to in a single day, errors happen and you get overwhelmed. Right from sending the…
How to Build a Basic Salesforce REST API Integration
Being within the package as a Service house, you have got to admire what Salesforce has managed to accomplish. It might be exhausting to argue…
Dynamic Components Creation in Aura | The Ultimate Salesforce Guide
Hello Devs, in Salesforce Aura framework, dynamic component creation stands as a powerful capability, enabling the generation of components dynamically during runtime, a functionality pivotal…
Popular Salesforce Videos
Guided Selling with Salesforce CPQ
Do you know how to set up guided selling in Salesforce CPQ? In this demo video, we'll show you three easy steps to set up…
Enhance Multi-Select Picklist Functionality With Flows to Increase Reportability | Salesforce
Multi-select picklists are AMAZING but have some MAJOR downsides. Do you like the functionality of muti-selects but hate reporting on them? Does the easy user…
How to Get Started on Your Salesforce Admin Certificate with Trailhead
In this video, Brad discusses how to get started with your Salesforce career using trailhead. He discusses how to create and validate your account, the…
Popular Salesforce Infographics
Features of Salesforce Spring’ 23 Release That Must Not Miss
The new updates in the Salesforce ecosystem will bolster the marketing power of the businesses. Companies are now more effectively building their marketing strategies which…
Management: Salesforce – 27 Incredible Sales Tips
Get a complete view of your customers, including activity history, key contacts, customer communications, and internal account discussions.. With sales software from Salesforce (Salesforce Sales…
Top Essential Features of the Salesforce Service Cloud to Improve Customer Service
The Salesforce Service Cloud is a powerful platform that can help businesses of all sizes improve their customer service. It offers a wide range of…