I would like to update fields in the "Invoices" table every time an child InvoicesDetail (aka Invoice Products) record is created, updated or deleted (e.g. the Sum of all Invoice Products privates or tax).
It's about the default Invoices + InvoiceProducts table (one Invoice can have n InvoiceProducts).
The goal is to solve this via Dataverse Accelerator App.
I am not ending up with the correct values, however and I can't figure out how to properly use the "Filter" function in this case:
Patch(
Invoices,
ThisRecord.'Invoice ID',
{
'Total Net Amount': Sum(
Filter(
'Invoice Products',
'Invoice ID'.Invoice = GUID(ThisRecord.invoiceid.'Invoice ID')
),
'Net net'
)
}
)
How to reference all children of the Invoice (referenced by the Invoice property of the currently updates/modified/deleted/created InvoiceDetails item)?