Forum Discussion

EmberKrumwied's avatar
EmberKrumwied
Qrew Captain
20 hours ago
Solved

Button formula to force a "reset" of snapshot field.

I have a parent table - Customers - there is a field for Sales tax rate. This rate can change periodically, so in my Charges table (that looks up the Customer) I am looking up the sales tax rate from the related Customer and then placing that value in a snapshot field. Charge calculations then use the snapshot field for the tax rate that way, if the Customer rate changes, historical charges will still be correct.

From time-to-time, new Charges are created before the Customer tax rate was modified, so now the new Charges are out-of-sync with the correct value. The only way I know to correct this is to edit the charge, remove the customer link, save and keep working, then reselect the customer.

Is there a way to build that logic into a button that would accomplish the same thing? Essentially turning 5 clicks into 1?

  • EmberKrumwied's avatar
    EmberKrumwied
    20 hours ago

    Thanks Mark. I decided to go with a editable text field that gets populated when the record is created, but then is editable on the fly.

2 Replies

  • Yes you can make a URL formula button to do that.

    not tested for syntax errors but try this

    var text DeSelectCustomer = URLRoot() & "db/" & dbid() & "?act=API_EditRecord&rid=" & [Record ID#] 

    & "&_fid_99=" // replace the 99 with the fid of the [related customer]

    var text ReSelectCustomer = URLRoot() & "db/" & dbid() & "?act=API_EditRecord&rid=" & [Record ID#] 

    & "&_fid_99=" & [Related Customer]

    var text RefreshPage =  URLRoot() & "db/" & Dbid() & "?a=doredirect&z=" & Rurl();

    $DeSelectCustomer
    & "&rdr=" & URLEncode($ReSelectCustomer)
    & URLEncode("&rdr=" & URLEncode($RefreshPage))

     

    • EmberKrumwied's avatar
      EmberKrumwied
      Qrew Captain

      Thanks Mark. I decided to go with a editable text field that gets populated when the record is created, but then is editable on the fly.