Question: Script that update a record that has the same fieldvalue as new record

Does anyone know how to delete a record that has the same criteria (person_id + project_id) as a newly added record?

Within our organization we have a table in which people give their estimate of hours per project. They fill this out via a form.

Now they have to give an update as soon as they see a change coming.

I am looking for a script code that will compare the fields (person_id and project_id) as soon as a new record is added and remove the old record if there is one and then add the new record. And if it is not there, then the record is simply added.

Does anybody know how to program this in a script?

Thanks in advance :pray:

This sounds like a straightforward use case for an automation script. Are you looking for a free script or do you have funds to hire someone to write the script?

Have you considered moving the data to a different linked table and using a system to identify the most recent record for each person/project combo? This way you could preserve the historical data while also using only the most recent data.

Thanks Kuovonne,

No I did considered your solution to move the most recent record to a new table. This can work.
Thanks Robert