-
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
Top Reasons to Learn Salesforce
Salesforce is the number one CRM (customer relationship management) and cloud-based platform that enables companies to manage, organize and track their internal information effectively and…
How Can the Combination of CRM+AI+Data Benefit Your Business?
In today’s fast-paced business environment, leveraging technology to gain a competitive edge is crucial. One of the most powerful combinations is the integration of CRM+AI+Data.…
Popular Salesforce Videos
5 Different Ways To Make Field Mandatory In Salesforce
Watch this video to check out 5 Different Ways To Make Field Mandatory In Salesforce. Do check out the playlist on Salesforce Lightning https://www.youtube.com/watch?v=gyJIB-y_OCE&list=PLfhCqnDpK3b_rnWbWj6c2O1P73SACq8D-
Salesforce Marketing Cloud Connect Complete Setup in Lightning
Cameron Robert demonstrates a complete end-to-end setup of Marketing Cloud Connect in Lightning view. Marketing Cloud Connect creates an integration between Salesforce CRM and Salesforce…
Create Reports In Salesforce With Report Builder
Create reports in Salesforce with Report Builder. In this video, the following points will be covered - 1. Introduction Get a brief introduction about reports…
Popular Salesforce Infographics
See How Building Apps on Salesforce Has Tremendous ROI
The pressure that businesses today are under to reduce costs, improve agility, and deliver better results is no joke. Couple that with rapidly evolving technology…
How Salesforce Outsourcing Can Help Your Business Grow
We all know how beneficial is Salesforce for any business but people still wonder if it is beneficial to go for Salesforce Outsourcing services. This…
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…