Add new int field to the parent entity and set the value using this formula script:
Code:
$invoiceCount = record\count('Contract', 'contractId', contractId); ifThen(entity\isNew(), $invoiceCount = $invoiceCount + 1); record\update( 'Contract', contractId, invoiceCount, $invoiceCount, );
Leave a comment: