-
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
The Future of Salesforce App Development
The use of mobile phones has made a lot of transformation with the way businesses are getting their products and services available to people. There…
Busting 5 Myths Around Salesforce
In today’s fast-paced world, there are a lot of businesses and start-ups who come up with a ground-breaking idea but unfortunately fail to make it…
How Does Salesforce Marketing Cloud Resolves the Marketing Challenges of Small Businesses?
With time customer demand also increases, and it becomes a challenge for the marketer to create and maintain brand and product awareness. It becomes more…
Popular Salesforce Videos
ChartJs Implementation In Salesforce
This was my very first lightning web component I had made on my own. Thought of sharing it 🙂 This component basically shows the no.…
Set Up a Microsoft Exchange Service Account to Sync with Salesforce (Using Command Shell)
You can sync sales reps’ contacts and events between your Microsoft Exchange-based email and Salesforce using the Salesforce feature Lightning Sync. If you’re an Exchange…
Salesforce Vaccine Management | Salesforce Vaccine Cloud
Leveraging technology to manage vaccines has become increasingly important. Salesforce is investing in the public sector to aid the efforts to combat the spread of…
Popular Salesforce Infographics
Salesforce Marketing Cloud
Salesforce Marketing Cloud is a platform where relevant and personalized journeys are delivered across different devices and channels. This allows the marketers to deliver right…
Unlock Agile and Efficient Salesforce Testing With AI-Driven Tools
Like every industry, the world of software testing and quality assurance has also gone under massive development with the emergence of AI technology. Developers and…
Dreamforce Facts & Numbers INFOGRAPHIC
We are now just a week away from the biggest Cloud carnival of the world ‘Dreamforce‘. Trailblazers from across the globe will be in San…