-
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
Master the Art of Customer Service with Case Management | Salesforce
What is the top priority for any business today? If you anticipated it as ‘Customer Experience’, you are probably right. Recent research found that nearly…
Reinforcing Fintech Companies, Salesforce Extends Einstein Analytics For Financial Services Cloud!
There has been a rapid change in the banking and wealth management industry, lately. Several modern fintech competitors have stepped in to simplify the ways…
Sort Picklist Values in Lightning Component | Salesforce Tutorials
In this article, you will learn to sort the values in Picklist in Lightning Component. You just have to add an additional line to your…
Popular Salesforce Videos
Leads & Opportunities for Lightning Experience - Create and Convert Leads
Learning Objectives After completing this unit, you’ll be able to: Update a record’s stage or status using Path. Update records in the Kanban view. Use…
Creating leads using Amazon Alexa with salesforce.
Amazon EchoAmazon Echo is a voice command device with functions like question answering, playing music and controlling smart devices. Echo connects to Alexa which is…
Introduction to Salesforce OmniStudio | Salesforce Industries
Introduction to Salesforce OmniStudio: The Salesforce OmniStudio digital engagement suite makes it easy to click-configure rich, consumer-grade user experiences based on objects, APEX classes, REST…
Popular Salesforce Infographics
CRM BENEFITS FOR SMALL BUSINESS
As small businesses become more established, business owners should start considering customer relationship management (CRM) systems that are both affordable and effective. In this infographic,…
All the Ways Salesforce Portal for Education Can Help Logistically
The education industry is layered and has multiple logistical elements in its workflow. How would we do it if we were to improve it? The…
In marketing, Can We Achieve What We Can’t Measure? | Salesforce
Metrics in marketing are always evolving and we can all learn more about them from our peers. Let’s look at where marketers are spending their…