I'm wondering if I'm missing something:
Using a classic layout in FileMaker 12.04 on Windows 7, I selected a drop down list field inside a portal (it's the only field in the portal row) and used the OnObjectSave trigger to perform the following script:
Show Custom Dialog [PortalTable::field ]
where PortalTable::Field refers to the portal field set with the OnObjectSave trigger.
I then tried editing the value in the field, both by selecting values from the drop down and by directly editing the field. I also tried both mouse clicks and pressing tab as a way to exit the field.
Each time, the custom dialog popped up and showed the current value of the field. I never saw the previous value of that field.
Can you spot anything that I'm doing differently?
I guess I should add one thing that I hope wasn't going to be a problem, but it may be the problem.
Instead of just two tables I am using three tables. 1 - The current layout is based on, 2 - the portal is based on, 3 - a related table to the one in the portal. I am editing a field in table 3 from the portal. Let me explain why.
I have a customers table and the portal is a statements table that is made for each month. The third table is the payments table, because there could be multiple payments made for one statement. Since they don't need multiple payments most of the time, I set the field up in the portal to edit the first related record of the payments table. I have a script that will remove them from the field if it finds more than one payment made for a statement.
Well, I created a brand new file with three related tables:
Enabled "allow creation" for table 2 and 3.
Put a portal to Table2 on the table1 layout
Used the same triggered script on a field from Table3 and got the same results.
I then put a portal to Table3 on the layout and set up a field from Table 3 with this same trigger and script.
Each time I am seeing the new value of the field.
Ok, I tried it with ShowCustomDialog and it worked. It must be my complicated Set field step.
Essentially it looks like this: Set Field [ Statements::Balance; Statements::DueAmount - Statements::calcSum_AmountPaid ] and that is all there is to the script.
So I'm using an unstored calculated sum of the payments field (AmountPaid) from the statements table.
(Note: I do have a calculated balance field, but for historic, reporting, and visual purposes I need a field that only updates when I want it to.)
(P.S. Not that anyone cares, but this is my 101th comment.)
That's a horse of a very different color. I would suspect that the issue there is that your aggregate function (Sum) won't update until records are committed. Exiting a field--which will trip the OnObjectSave does not commit records.
Ok, well, thank you for your help, Phil!