Discussions

Expand all | Collapse all

Need to track and calculate a changing numeric field

  • 1.  Need to track and calculate a changing numeric field

    Posted 12-05-2018 21:49
    My boss has informed me that from an auditing standpoint, users should not be allowed to change the original order quantity field, but instead we should design a system that logs each numeric change (for example -5 or +9), while also using each value in a transaction log so that the final total (whether + or -) can be added to the original value in order to get the true value. 

    Any ideas on simple yet effective ways to implement this? 

    Thanks for any help. 


  • 2.  RE: Need to track and calculate a changing numeric field

    Posted 12-05-2018 22:19
    Can be done with a webhook or automation. If you need to record the old value and the new value of the order quantity field, use a webhook as you can access the old value as well as the new value in a webhook.


  • 3.  RE: Need to track and calculate a changing numeric field

    Posted 12-05-2018 22:20
    Would I just create a record in a different table every time the value changed in the source table/record?


  • 4.  RE: Need to track and calculate a changing numeric field

    Posted 12-05-2018 22:23
    Yes. Create another table and make sure the webhook adds a new row in that table whenever this field changes. Technically speaking, you could extend this to other fields on the orders table as well. It is your call, though.


  • 5.  RE: Need to track and calculate a changing numeric field

    Posted 12-05-2018 22:24
    Yes, you would create an audit trail child table and record the old and new values.  if there are multiple fields to track, then include in the child table and identifier of the field that was changed.  Like Cost or Sell.

    Using an ACTION will allow you to record the old and the new value.  Automations don't yet do the "old" value,.


  • 6.  RE: Need to track and calculate a changing numeric field

    Posted 12-06-2018 14:48
    Thanks for the help.