Announcement

Collapse
No announcement yet.

Increment ID in invoice/contract

Collapse
X
 
  • Filter
  • Time
  • Show
Clear All
new posts

  • Increment ID in invoice/contract

    Hello

    I want to make an ID number where which contract has invoices and this invoices have ID incemented by 1
    how can I know the previous of each record invoice which below to that one contract.

  • #2
    Hello,

    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,
    );
    Last edited by eymen-elkum; 11-18-2021, 12:39 PM.
    CEO & Founder of Eblasoft.
    Professional EspoCRM development & extensions.

    Comment

    Working...
    X