function readOnly(count){ }
Starting November 20, the site will be set to read-only. On December 4, 2023,
forum discussions will move to the Trailblazer Community.
+ Start a Discussion
dev33dev33 

Add a new record without having to go to another page

I have a scenario where

1) A visualforce page shows a list of records of a custom object named YAccount.

2) When I click on any of these record's names, a new vf page opens up with the details of that record and a related list called Orders with all the records in it.

 

       Now If I use the standard <apex:relatedlist> tag to display this "Orders" related list, it has a new order button and clicking it would take me to a new page to add a new record to the Orders.

 

The requirement is to be able to add a new record in the same page at the end of the table that's showing the list of Orders related to that particular YAccount.

 

Any suggestions on this are appreciated.

Thanks.

bob_buzzardbob_buzzard

It sounds like you just need a form at the bottom of the page to capture the details, and then a commandbutton to invoke an method on your controller that inserts the record. You could then refresh the entire page to show the updated list of orders.