2

I have 3 fields on Order Line Item:

  • Ordered Quantity
  • Delivered Quantity
  • Remaining Quantity

These fields are easy to create by using a simple formula. I would like to create a new field : Quantity_Already_Delivered.

This field is the sum of Delivered Quantity for each item, so my query could be like this

SELECT Id, SUM(Delivered_Quantity__c) FROM Sales_Order_Line_Item Where Id = 'Id_line_Item'

I would like to return only the sum (Delivered_Quantity__c) as a number.

The problem is that the query doesn't work on a formula field.

How can I resolve this?

4
  • 1
    That architecture does not make sense. You should have Delivery Quantity on the Opportunity and then you can use it as a rollup summary
    – Eric
    Jul 13, 2015 at 5:50
  • 1
    I also agree with Eric. What he suggested - field on parent and having roll up summary seems to be better idea. Also, your query seems to be querying one row of 'order line item'. How you're intending to get sum of that field from multiple rows ? Jul 13, 2015 at 6:18
  • thank you for your response , the fact is I have sales order Object , inside we have Sales Order Line Items where we can find all items . I create a button Create delivery note and Delivery note was created on the same page ( Sales Order ) . That I would like to know is if it's possible to get the sum of ( Delivered Quantity) on Sales order stage ?, because , it's possible that we create a lot of Delivery note . Jul 13, 2015 at 7:45
  • if we create a field as a roll up summary on parent object , how can this field could resume the sum of delivered quantity for each item ? Jul 13, 2015 at 8:25

0

You must log in to answer this question.

Browse other questions tagged .