-
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
Transforming Customer Engagement with Salesforce Experience Cloud: Best Practices
With high customer expectations in today's digital world, businesses must be at the forefront of customer engagement strategies. Salesforce Experience Cloud is the key to…
5 Best Sales Cadence Tools for Automating Your Outreach
Today, sales tools are more than simply "nice-to-haves". They assist sales representatives by automating routine processes and increasing overall sales effectiveness to free up time…
What is Salesforce B2B Commerce Cloud?
The eCommerce industry has witnessed tremendous growth in recent years as businesses increasingly turn to digital platforms and technologies to expand their reach. In this…
Popular Salesforce Videos
Is Salesforce A Good Career In 2022?
Wondering whether Salesforce is a good career or not? Still have some doubts about it. Watch this video and join this useful group for Salesforce…
Simple Salesforce to Salesforce Data Migration Step by Step | 100% Salesforce Native App
How to Migrate Salesforce Data? Create Template: As the name suggests, this is just like a sandbox template; these templates store template lines & various…
Lesser Known VSCode Tips for Salesforce Developers
More Code, Less Work. Whether you are a beginner or an advanced developer, smart tips, and sharp tools can significantly improve your productivity. There are…
Popular Salesforce Infographics
Salesforce CPQ Services & Processes: InfoDrive Solutions
Simplify your CPQ processes with InfoDrive Solutions Salesforce CPQ services. Work flexibly from any location, on any device, enhancing productivity and increasing deal-closure chances for…
Quick Comparison Guide to CRM Systems: Acumatica VS Salesforce Sales Cloud
When you are about to choose, the best and the most appropriate CRM solution for your business, always consider these 3 given points: customization, integration,…
Salesforce vs. HubSpot: Which CRM is Best For Your Business?
Salesforce has highly customizable lead management and scoring, while HubSpot can get small businesses up and running quickly with lead generation via content marketing. HubSpot…