Use calculated values when inserting connected records?

I have an app that manages bills and payment. I am attempting to make an action limk that will create a payment (connected record) for the amount that is due, and mark the bill as “paid in full” in a table of ‘bills’

The “total due” is entered manually with the ‘Bill’ data. Payments and credit memos are held in separate databases, and their values are used to calculate the “Current Due”. (total due - payments = current due, essentially)

When I create the action link, and attempt to assign a value to 'payment amount" (payment), I want to do so using the calculated “Current Due” (bill); however, the only value it offers is the initial “total due” (bill). I assume that this is because it is a calculation, and not a ‘number’? Is there a trick or method I can use here, other than just updating the ‘current due’ each time a payment is added?

What field type are you using for your calculation? Formula or equation?

Basic Equation. I created an adjacent Formula field, and I am able to use that value when inserting the payment record. The button is working great! I don’t mind having both the equation and formulas, as it seems that it may allow me to more simply expand the system in the future.

The issue I’m having now, is getting the numbers to update more quickly. I have added a “modified date” field to the end of each record, and added an action step to update that date between applying the payment and checking the balance to determine if the bill is paid in full. Seems to work consistently for applying payments, only
Apply Payment > Update date (calculate balance) > Marked bill paid if $0 balance

The issue I run in to, is if I then delete a payment. The calculations do not update to reflect the removal of the payment.
I have a task created to update all bill statuses based on balance and due date (for example, a bill is paid, marked paid in full, that payment is then deleted, this task would mark that bill back to either balance due or past due, depending on the due date), however, it doesn’t work until the calculated balance (formula) has been updated. If I manually validate the equation (just a copy of the equation, which updates correctly), all of the data updates, and everything works. I just need to figure out how to consistently force the formula fields to update. I think I saw an old thread on the matter, so I’m looking for it now.

I seem to have performance issues after I’ve been using tadabase for a while, so I think that may be a factor as well?

I believe that this might be a bug with the delete function not updating the records but I’m not sure. I don’t know if you have ever used Integromat but there is a trigger that watches for records that are deleted and at which time you can run a scenario. I have used this feature of Integromat and it works quite well.