-
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
6 Salesforce Administration Mistakes You Must Avoid
It takes a variety of roles, experiences, and skill sets to manage Salesforce. From tech architects, developers, and admins to consultants, companies need diverse resources from…
Sneak Peek: Latest Features And Updates of Salesforce commerce Cloud
With rising customer expectations in a tech-savvy marketplace, it has become critical for retailers to deliver top-shelf shopping experiences to stay relevant and competitive in…
Popular Salesforce Videos
Salesforce Standard vs Custom Objects Explained
Salesforce, a leading customer relationship management (CRM) platform, offers both custom and standard objects to organize and manage data effectively. Standard objects are pre-built components…
Top 3 Reasons to Use Salesforce Checkout
Watch this video to understand your Salesforce contract information, make payments, and add additional licenses with Salesforce Checkout. This video discusses about the top 3…
Salesforce Spring ‘21 Release Notes Highlights & Summer ‘21 Preparation
Spring ‘21 Release Notes Highlights & Summer ‘21 Preparation In this session we discussed 00:00 Bella Vista, Western Sydney Developer Group Overview 03:30 Andrew Whitten…
Popular Salesforce Infographics
The Best Salesforce Certifications to Look for in 2020
Salesforce tops the charts across the world in Customer Relationship Management. It is not one of the best, but the best in the game. It is…
Salesforce vs SAP CRM
Although Salesforce and SAP both provide CRM software to the customer, both are still much different from each other. Salesforce is one of the earliest…
How Your Business Can Leverage The Power of Salesforce Community Cloud?
Community Cloud is a cloud-based platform that enables businesses (small, medium, big) to build exceptional and interactive CRM-powered portals, forums, and sites that are faster…