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

How can I get the Order Product information into my VF page?
Hello,
I'm building a VF page which retrieves info from the Order standard object and I have some difficulties to retrieve the information from the Order Products. How can I achieve it?
It seems to me there is no specific standard field in the Order standard object, but searching on the Internet it seems the Order Products are controlled by OrderItem but I don't understand how to retrieve the information to my VF page.
Also I need to create it for my VF page, not just for one specific order (I mean, one order ID), but also for every order it's registered into the system.
Thanks in advance.
I'm building a VF page which retrieves info from the Order standard object and I have some difficulties to retrieve the information from the Order Products. How can I achieve it?
It seems to me there is no specific standard field in the Order standard object, but searching on the Internet it seems the Order Products are controlled by OrderItem but I don't understand how to retrieve the information to my VF page.
Also I need to create it for my VF page, not just for one specific order (I mean, one order ID), but also for every order it's registered into the system.
Thanks in advance.
- Please check the below link for further reference.
- https://developer.salesforce.com/forums/?id=906F0000000DEurIAG
I hope it will be helpful.Best Regards
RahulKumar
You can use following code to get the order item information
visuval force page
controller
Thank you
Many thanks for your replies.
I've done the following:
First of all, I create an Apex Class exactly as Ramssf70 said. However when I insert the code part in my VF page, I get an "Error: Unknown constructor 'orderitemcontroller.orderitemcontroller(ApexPages.StandardController controller)'"
Part of my VF code is:
As I said before, I need the StandardController="Order" to retrive information regards contact (name, e-mail, etc.)try this bellow code
visuval force page
Controller
public class orderitemcontroller
{
public List<orderitem> orderItemList{get;set;}
public orderitemcontroller(ApexPages.StandardController controller)
{
List<order> orderset =[select id from order limit 5];
List<OrderItem > orderItemList = [SELECT Description,Product2Id,Quantity ,OrderId FROM OrderItem WHERE OrderId IN:orderSet];
}
}
if you have any queries please let me know i can try to help you
Thank you
Ramssf70, after creating a new Apex Class with you Controller code and insert your VF page code into my VF page, I get the following error when trying to save my VF page: "Error: Unknown property 'OrderStandardController.orderItemList'".
In order to eliminate other possibly causes of the error from my VF page code, I've created a new VF page with your VF page code and nothing happens when I pass the ID through the URL. It's supposed to show only the Order Products for the ID of the order, isn't it?
Thanks for your help and kind regards.