You need to sign in to do that
Don't have an account?
Mohammed Ikram 7
I want to Display all child invoices of a customer , I created a class controller
I want to Display all child invoices of a customer , I created a class controller,
public class ListOfChildRecordsInvoices
{
public List<Invoice__c> ListOfInvoices {get;set;}
//List<Invoice__c> ListOfInvoices;
public List<Invoice__c> getInvoices() {
List<Customer__c> ListCustomers = [SELECT Name, Id,
(SELECT id, Name,Amount__c,Status__c FROM Invoice__r) FROM Customer__c WHERE Name = 'IBM'];
if(ListOfInvoices == null)
{
List<Invoice__c> ListOfInvoices = ListCustomers[0].Invoice__r;
}
return ListOfInvoices;
}
}
My visualForcepage is
I am not getting the results , please help
public class ListOfChildRecordsInvoices
{
public List<Invoice__c> ListOfInvoices {get;set;}
//List<Invoice__c> ListOfInvoices;
public List<Invoice__c> getInvoices() {
List<Customer__c> ListCustomers = [SELECT Name, Id,
(SELECT id, Name,Amount__c,Status__c FROM Invoice__r) FROM Customer__c WHERE Name = 'IBM'];
if(ListOfInvoices == null)
{
List<Invoice__c> ListOfInvoices = ListCustomers[0].Invoice__r;
}
return ListOfInvoices;
}
}
My visualForcepage is
<apex:page controller="ListOfChildRecordsInvoices" id="thePage"> <apex:dataTable value="{!ListOfInvoices}" var="Stud" id="theTable" rowClasses="odd,even" styleClass="tableClass"> <apex:facet name="caption">Invoices Details</apex:facet> <apex:facet name="header">Invoices data</apex:facet> <apex:facet name="footer">End Of Page</apex:facet> <apex:column > <apex:facet name="header">Name</apex:facet> <apex:facet name="footer">column footer</apex:facet> <apex:outputText value="{!Stud.Name}"/> </apex:column> <apex:column > <apex:facet name="header">Amount</apex:facet> <apex:facet name="footer">column footer</apex:facet> <apex:outputText value="{!Stud.Amount__c}"/> </apex:column> <apex:column > <apex:facet name="header">Email</apex:facet> <apex:facet name="footer">column footer</apex:facet> <apex:outputText value="{!Stud.Status__c}"/> </apex:column> </apex:dataTable> </apex:page>
I am not getting the results , please help
Your code is not working because controller does not return invoices, I have slightly modified the controller, please use the following code and let me know if it works:
Mark my answer best if it does help you.
Thanks,
Rahul
All Answers
Your code is not working because controller does not return invoices, I have slightly modified the controller, please use the following code and let me know if it works:
Mark my answer best if it does help you.
Thanks,
Rahul
I am new to Salesforce. This really helped me.
Thanks Again. Thank you very very much.
Can you please also let me know how to pass the value from visualforce page field and get the result from the class.
Sample code will help me.
Adding a query for my previous question.
I want to display the Customer Name and well as Address, from the class we can get it by
system.debug('ListOfCustomers is '+ListCustomers[0].Name);
system.debug('ListOfCustomers is '+ListCustomers[0].Address__c);
But how to return that, so that we can display that in the VFpage.
Can you please also let me know how to pass the value from visualforce page field and get the result from the class.
Sample code will help me.
Thanks in Advance.
Ikram
Below is the code for your requirement:
Hi Rahul,
Thanks for the help.
Can you please also let me know how to pass the value from visualforce page field and get the result from the class.
Sample code will help me.
Thanks
Are you located in India?
Share your email and Phone no , if you have no problem, we can be in touch for any help.
my email is ikrammohiuddin@gmail.com (mailto:ikrammohiuddin@gmail.com)
Thanks
Ikram
I work in Bengalore,now a days I am onsite (Malasiya). You can any time what's app me on my number +9741717420 or email me on my rmail: rhlmishra782@gmail.com