You need to sign in to do that
Don't have an account?

Populate a field on VF page
Hi,
I have this VF page for Custom object (invoice__c). User when they post comment it display the date, comments and who posted it. it shows like this from column (A to C). We woul like capture another field "Assigned To" (column D) on this page. So when user write comments they assigned it to some other users.

"Assgined To " is on the parent object (invoice__c) but i want to capture on child page too (invoice_detail__c)..here is my controller:
Please help.
I have this VF page for Custom object (invoice__c). User when they post comment it display the date, comments and who posted it. it shows like this from column (A to C). We woul like capture another field "Assigned To" (column D) on this page. So when user write comments they assigned it to some other users.
"Assgined To " is on the parent object (invoice__c) but i want to capture on child page too (invoice_detail__c)..here is my controller:
public with sharing class invoicedetails { Private final Id InvoiceId; public invoice_detail__c invoicedetail {get; set;} public invoice__c invoice {get; set;} public list<Invoice_detail__c> details { get { try { string sRecordid=String.escapeSingleQuotes(InvoiceId); list<Invoice_detail__c> tempdata = new list<Invoice_detail__c>(); tempdata = [select Date__c, Text__c ,createdbyid from Invoice_detail__c where Invoice__c=:InvoiceId order by Response_Date__c desc limit 50000]; system.debug('\n----'+tempdata); return tempdata; } catch(exception ex) { return new list<Invoice_detail__c> (); } } } public invoicedetails(ApexPages.StandardController controller) { try { InvoiceId = controller.getId(); invoicedetail = new Invoice_detail__c(); invoice = new Invoice__c(); } } public Pagereference saveResponse() { try { String sRecordid=String.escapeSingleQuotes(InvoiceId); if((sRecordid.length() == 15 || sRecordid.length() == 18) && Pattern.matches('^[a-zA-Z0-9]*$', sRecordid)) { if(checkParticipants(sRecordid)) { invoicedetail.Invoice__c=InvoiceId; //use for date and time(march release) invoicedetail.Response_Date__c=Datetime.now(); system.debug('\n----invoicedetail--'+invoicedetail); insert invoicedetail; invoice.id = InvoiceId; invoice = new Invoice__c(); invoicedetail = new Invoice_detail__c(); PageReference CurrentPage = new PageReference('/'+InvoiceId); CurrentPage.setRedirect(true); return CurrentPage; } } return null; } } }
Please help.
First you need to create a field on Child Object for storing the value, then refer the vaule in VF page and use same code it will work.
Please let me know
--
Thanks,
Swayam
It's a process that user has to go to parent obecjt an assign to user__c. I need to copy that value from user__c to assgined__c.
No need to copy the value from Parent object, simplly instead of creating Text field, use formula field, (Refrence to the inovice__r.User__c), It wil auto populate.
Hope this helps,
--
Thanks,
Swayam
I added a comment, today and assigned to David. Later
Mary posted the comments and asigne to Geroge.
If I will use Formula, then for each row it will show the exisitng Assigned person. I want to kep track in the form so it is easy to check who assigned to comment to whom.