Point In Time Transactions

Hi All, 

I am trying to create Point In Time transactions and can't figure out the best way to do it.  Here is the scenario: 

Object 1 - Profile

Object 2 - Profile PIT (Point In Time)

Anytime a record in Object 1 gets added, I insert a new transaction into Object 2 (I have a connection).  That works fine.  I assign the Effective Start Date with the current date/time and leave the Effective End Date blank. 

Next, if Object 1 gets Edited, I repeat the step above where I insert a new transaction into Object 2.  However, I want to go back to the first record created in Object 2 and update the Effective End Date with the current date - 1. 

There is no way to use the form rules to accomplish this from what I see.  Any recommendations on how to accomplish this?

Thanks for any help you can provide. 

Charlie

This will require some JavaScript and utilizing the record-update on the view where your first record is updated.. 

const identification_view = 'view_234'; // View where first table is updated

$(document).on('knack-record-update.' + identification_view, function (event, view, record) {

    Query second table with your record.id to find the connected record

   Update the record.

});

Julian