-
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 Salesforce Service Cloud
Salesforce is the most popular CRM-based service provider with numerous amazing products. It has the largest market share among CRMs and offers users great quality…
Salesforce Marketing Cloud Implementation Partner in the USA
Kizzy Consulting, a trailblazing force in the Salesforce ecosystem, stands out prominently as a Salesforce Marketing Cloud Implementation Partner in the USA. With a proven…
Exception Handling in Salesforce
Exception: "An exception is an event, which occurs during the execution of a program, that disrupts the normal flow of the program's instructions." Don’t forget…
Popular Salesforce Videos
Algoworks Is Now A Salesforce Summit (Platinum) Partner | Salesforce Consulting Services
It's been just a year since we became Salesforce gold consulting partners. Algoworks has now been recognized as a Salesforce Summit Partner (also known as…
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…
Process Builder In Salesforce | Tutorial Video
Do you want to create a record for any object from a workflow? Do you want to call your Apex class from a workflow? Do…
Popular Salesforce Infographics
How Salesforce Improves User Experience Through Hyper-Personalization?
Personalized service has become an imperative part for any business to succeed in the cut-throat competitive market. 66% of people want companies to understand their…
Best Salesforce1 SMS Mobile App - 360 SMS App
360 SMS App is a One-stop texting solution platform for almost all kinds of industries including Healthcare, Hospitality, Education, etc. It can be your saviour…
7 Key Factors to Keep in Mind When Selecting Salesforce CPQ Software
Today, sales teams are increasingly overwhelmed with complex product offerings and customers’ expectations to deliver quick and personalized experiences. That’s why, sales professionals are inclining…