Recalculate formula after creating an object with record\create()

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • dkvartal
    Junior Member
    • Jan 2020
    • 16

    Recalculate formula after creating an object with record\create()

    Hello. I have two entities: Service and Transaction. They have links to each other. Service.transaction and Transaction.service. In Service's formula I need to create a new Transaction with empty fields and set Transaction.service to Service itself. I have a logic in Transaction's formula to fill in fields using a Service object in Transaction.service. I did it with this code:
    Code:
    $newTransactionid = record\create('Transaction');
    transactionId = $newTransactionid;
    It creates a new Transaction object and adds a link to its Service, but Transaction's formula doesn't calculate after creating a Transaction with record\create('Transaction') and all fields remain empty. After manually recalculating the new Transaction the fields are filled in. Is there any way to recalculate records formula with code?
    Last edited by dkvartal; 02-26-2021, 07:33 PM.
  • dkvartal
    Junior Member
    • Jan 2020
    • 16

    #2
    Solved my problem with Hooks. As I understood formulas calculate before saving. It will be great to add an ability to calculate it after saving too

    Comment

    Working...