-
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

What is the Apex Metadata API? | All You Need to Know
Let’s say that you support multiple orgs, and you’ve created a custom field. You want to add your new field to the page layouts in…

Salesforce Lightning: Two Thumbs Up
How Your Organization and Users Benefit from Salesforce Lightning Implementation Salesforce has offered the Lightning Experience for over two years, and every release update is…
Popular Salesforce Videos
Trailblazer Moment - Investing in Canada's Future
Salesforce Ventures is excited to announce our Canada Trailblazer Fund, a $100 million fund to invest in Canadian startups and fuel cloud innovation and customer…
How Salesforce Industries can be Used on Top of Salesforce?
Salesforce Industries offers pre-built solutions on the Salesforce platform that solve the needs of particular industries. Vlocity takes these common requirements and packages them into…
How to Become Salesforce Developer in 2022 | Salesforce Career Path
Anyone can become a Salesforce developer. It takes to learn Salesforce-specific developer skill sets and does not account for time spent in formal education or…
Popular Salesforce Infographics

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…

Top 5 Salesforce apps for sales and marketing managers
The sales rep, marketing professionals can effectively manage on the customer inquiries from different geographical areas through Salesforce CRM. Here I’m offering a roundup of…

What is Salesforce Architecture?
Have you ever wondered that what is so special about Salesforce? How does it manage to accomplish so much in such a less time? Well,…