EspoCRM Ebla Link Pro Aggregation Data Integrity

Calculate Parent Totals from Child Records in EspoCRM

Eymen Elkum headshot Eymen Elkum
EspoCRM order-item values flowing into a calculated parent total

Calculate reliable parent totals in EspoCRM with Ebla Link Pro without relying on a fragile per-row difference formula.

An order total is an aggregate of all active order-item prices. The calculation must remain correct when a row is created, edited, removed, restored, imported, or changed by another user.

The historical approach of adding only the latest row’s difference to the parent does not cover all of those cases and can drift under concurrent updates.

Before you begin

You need administrator access to Entity Manager. The recommended inline-total procedure requires Ebla Link Pro 3.58 or later, EspoCRM 9.3 or later, and PHP 8.1 or later. Test create, edit, deletion, restoration, import, and concurrent-update paths with representative data before using the total for invoices, payments, or reporting.

Example data model

  • Parent entity: Order
  • Parent total field: totalPrice
  • Child entity: OrderItem
  • Child value field: price
  • Relationship: one Order has many Order Items

Use Currency fields for monetary values when currency handling is required.

Ebla Link Pro 3.58 supports footer sums for one-to-many inline lists and can map a footer value back to the parent record.

Step 1: Enable the inline Order Items form

Open Administration → Entity Manager → Order → Fields → Order Items and:

  1. Enable Enable Form.
  2. Select the layouts used by the inline list.
  3. Ensure price is included in the selected layout.
  4. Save the field.

In the same field settings:

  1. Add child price to Footer Sum Fields.
  2. In Footer Sum Fields Map, map Price to parent Total price (totalPrice).
  3. Save and run Administration → Rebuild if the metadata does not refresh immediately.

EspoCRM Ebla Link Pro field settings mapping the Order Item Price footer sum to the Order Total price field

The live Link Pro configuration maps the child Price sum to the parent Total price field.

Link Pro now displays the sum below the inline list and keeps the mapped parent field synchronized as users edit the rows through the form.

Step 3: Protect the source of truth

Treat Order Items as the source values and Order.totalPrice as their derived result:

  • make the parent total read-only for normal users;
  • do not add a second formula that independently adjusts the same field;
  • ensure imports and integrations use a supported path that recalculates the total;
  • test row removal and deletion, not only creation and editing.

Do not copy a formula that increments the parent by a row-level difference unless it also handles deletion, restoration, reassignment to another parent, imports, and concurrent saves.

Use a server-side recalculation that queries all current child records and writes their complete sum to the parent. Trigger it after every operation that can change membership or the source value. For high-volume or financially sensitive data, implement this as a reviewed extension service or hook with transaction and concurrency behavior appropriate to the installation.

Test the complete lifecycle

Start with an empty Order and verify:

  1. Add two rows and confirm the footer and parent total.
  2. Change a child Price value.
  3. Set a numeric value to zero.
  4. Remove a row before saving.
  5. Save, reopen, and edit an existing row.
  6. Remove or delete an existing child record.
  7. Move a child to another parent if the relationship permits it.
  8. Repeat an update from two browser sessions when concurrent edits are possible.
  9. Test the API or import path used by integrations.

The parent total is reliable only when every supported write path produces the same result.

Common problems

Confirm the Footer Sum Fields Map entry and verify that the target parent field has a compatible numeric or Currency type.

The total updates only in the browser

Confirm that the mapped parent record is saved and that external writes use a recalculation path. An inline UI calculation alone is not a substitute for server-side integrity when other clients can modify the data.

Currency totals are incorrect

Do not sum amounts from different currencies as if they were identical. Normalize values to one currency or maintain separate totals according to your accounting rules.