AnsweredAssumed Answered

Prevent committing portal records if total is not zero.

Question asked by srzuch on Jan 29, 2015
Latest reply on Feb 1, 2015 by user19752

I have a portal whereby when I enter new "detail" records, or change a current detail record, the total of the detail records' amounts must be zero before the transactions are committed.  (For any accountant, think of a journal entry transaction whereby the debits and credits must net to zero before posting).


If I have an unstored calculation field in the "master" record that SUMs the detail record amounts, the portal layout displays the correct total, but the actual total as shown in the data viewer does not reflect the changes until the portal is committed.  I can't use the calculation field for validating the zero total condition before committing the transactions.


If I use a summary field from the detail table, the summary field does reflect the changes to the detail amounts as they are made, and the summary field can be used to test for the zero amount condition.  The only problem with the summary field is that the layout display needs to be refreshed (refresh object works, along with refresh windows).


So it appears to this new FM user that a summary field from the detail table is the more appropriate choice to validate that the total of the detail records are zero before the transactions are committed.


FYI - I am not using the separation model; zero total test is being done in the layout OnRecordCommit trigger; object refresh is being done in the detail amount field OnObjectExit script trigger, and the object being refreshed is the detail summary field.


Just trying to confirm that my understanding is correct.