-
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
Go Green – Paper to Digital to Salesforce
It’s a known fact that paper forms are still in use by many industries and the impact is both on the environment and on the…
Top Salesforce Spring '23 Service Cloud Features
With the all-new Salesforce Spring '23 Service Cloud features discover new capabilities that will assist you and your team provide efficient, high-quality service. Share links,…
Pagination of an Infinite List of Records in Salesforce: Challenges and Resolution Methods
Author: Ievgen Kyselov, Salesforce developer at NIX This pagination approach is not new or uncommon, but it's rarely discussed in detail. What I am showcasing…
Popular Salesforce Videos
Learn About the Before Trigger in Salesforce Flows
Here I am creating 2 scenarios for before - Save Updates in Salesforce Flows Salesforce Summer '20 Flow Builder feature. Creating or updating a record…
Integrate Salesforce and Active Directory Step by Step
The prospect of implementing Single Sign-on in your Salesforce org can seem daunting if you are unfamiliar with the process. In this live step-by-step demo…
How to Close Complex Deals Fast with Salesforce CPQ+
CPQ Salesforce, or Configure, Price, Quote Software by Salesforce is a sales tool for companies to provide accurate pricing with any given product configuration scenario.…
Popular Salesforce Infographics
7 Must Know Features on the New Salesforce AppExchange
Personalized recommendations, intelligent search, and new solutions are just a few of the exciting new features on the brand new AppExchange. Check it out at…
The ROI of Building Apps on Salesforce
With our ROI Calculator, embark on a journey to discover how much more productive your organization can be when building apps using the Salesforce Platform.…
Your Guide to Salesforce Certifications
In the age of customer experience, businesses now rely on their CRM systems more than ever. As the world leader in CRM software, Salesforce knows…