Field not being changed
I'm tracking donations for a charity, and running into something weird. Leaving out unrelated (AFAIK) stuff, here's the structure:
There's a Contacts table, and a related Donations table. The latter has the usual fields, plus a boolean "Needs Receipt?" checkbox for each donation.
To track which contacts have donations requiring a receipt, I have a field on Donations called "AmountReceiptNeeded". It's zero if "Needs Receipt?" is unchecked, or contains the donation amount if it is.
The contacts table includes a field called "AmountReceiptNeededSum", which totals up the related "AmountReceiptNeeded" fields. If it's larger than zero, that donor - and their total donations requiring a receipt - are included in a portal on a “home” or “dashboard” layout.
So far, so good. But:
I’m trying to improve that portal’s speed by having it depend on a table relationship, not a portal filter. To do so, I’ve had to set up stored versions of the above fields since they’re all calculation fields and thus unable to be part of a table relationship. (As I've learned!)
So, I have to add script steps to manually copy over the value of the original fields into non-dynamic, stored versions of those fields, whenever the “Needs Receipt?” box is checked or unchecked, or when a reciept is deleted. (Those non-dynamic fields are used in the table relationship.) And, it’s working great…. with one exception.
When I delete a receipt, the “AmountReceiptNeededSum” field on Contacts dynamically updates as expected, but I need to then copy that new amount into the stored version, “AmountReceiptNeededSum_STORED”.
But it’s not happening.
On the Contacts layout, it’s wrong. It’s not updated.
My “Delete Donations” script (slightly paraphrased in spots) looks like this:
(Custom dialog to confirm deletion)
If (user said yes)
Exit Script 
Delete Record/Request [No dialog]
Set Field [Contacts:: AmountReceiptNeededSum_STORED; Contacts:: AmountReceiptNeededSum]
But on the Contacts listing, it hasn’t happened. The calculation field is working fine, but it's not being copied over to the other field.
I’ve added the fields in question over on the right in the attached sample listing.
I can’t figure out why this isn’t working… hope someone can point me in the right direction!