Sum of Child Items and Update Total Amount of Parent Using Formula

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • Triggerz
    Member
    • May 2024
    • 95

    Sum of Child Items and Update Total Amount of Parent Using Formula

    Hi,

    I created two entities namely CashAR (the parent entity with a field name called cartotalamount) and CashARitems (the child entity with a field name called caramount)
    I then created a one-to-many relationship in CashAR with CashARitems as the foreign entity
    I then added the CashARitems in the Bottom Panels layout so that users can add CashARitems that is related to the CashAR record being updated or created

    When a user saves the changes in CashAR record, I want to sum up the total of CashARitems.caramount and then update the value of CashAR.cartotalamount

    How can I do this in a formula?

    Thanks & Regards...
  • Triggerz
    Member
    • May 2024
    • 95

    #2
    Hi Everyone,

    I was able to resolve the updating part by creating a workflow with the following formula:
    totalamt = entity\sumRelated('casharitemses', 'caramount', '');

    The only problem is that, I need to refresh the browser just to see the changes reflect on the screen. Is there a way to update the screen as the workflow gets executed?

    Thanks

    Comment

    • lazovic
      Super Moderator
      • Jan 2022
      • 930

      #3
      Hi Triggerz,

      Please tell me what type of trigger does your workflow have?

      Comment

      • Triggerz
        Member
        • May 2024
        • 95

        #4
        Hi lazovic, the trigger is After record saved (created or updated)

        Regards...

        Comment


        • lazovic
          lazovic commented
          Editing a comment
          Unfortunately, there is no such option, so that in this case the record is updated immediately after the workflow action fired. You will be able to see the changes when you refresh the page or open the record again.
      Working...