Use Formula Field To Sum Up Number Fields On The Child And Display On Top Object (Doc ID 2122134.1)

Last updated on APRIL 20, 2016

Applies to:

Oracle Fusion Sales Cloud Service - Version 11.1.10.0.0 and later
Information in this document applies to any platform.

Goal

I have a Formula number field in Sales Order custom object, and in Invoice child object there are couple of records where all have a value Invoice amount. Here I am trying to fetch the summation of all invoice value and update it in Sales order formula field.

Formula field in Sales Order object - TotalInvoice_c
Number field in Invoice child object - InvoiceAmount_c


def var_inv = InvoiceCollection_c


if(var_inv.Status_c=='New')
{
while(var_inv.hasNext()){

b=setAttribute('TotalInvoice_c',var_inv.InvoiceAmount_c);
  return true
}
}

Expected Result:

TotalInvoice_c= InvoiceAmount_c + InvoiceAmount_c + so on .i.e, it depends on the number of records in child object. when ever I create a new record in invoice, the Total invoice should get updated. if any of the invoice status is updated to cancelled, the Total invoice value should get updated.


The above code is not fetching any data
 

Solution

Sign In with your My Oracle Support account

Don't have a My Oracle Support account? Click to get started

My Oracle Support provides customers with access to over a
Million Knowledge Articles and hundreds of Community platforms