Sales Header - Prepayment

Hello,

I have two new fields in Sales Header: Final Total Amount and Prepayment Amount, and an originally existing field: Prepayment %.
If I change the value of Prepayment Amount I would like Prepayment % to be changed automatically and vice versa.

I wrote this code to OnValidate() triggers of Final Total Amount and Prepayment Amount, and it works perfectly.
VALIDATE (“Prepayment %”, (“Prepayment Amount”/“Final Total Amount”)*100);

I tried this code to OnValidate() triggers of Final Total Amount and Prepayment %, but it is not working.
VALIDATE („Prepayment Amount”, „Final Total Amount”*(„Prepayment %”/100));

In OnValidate() trigger of Prepayment % there is already this code:
UpdatePrepmtType;
UpdateSalesLines(FIELDCAPTION(“Prepayment %”),CurrFieldNo <> 0);

If I write my code before these lines, I get the error message:
There is insufficient memory to execute this function. This can be caused by recursive function call.
If I write my code after these lines, I get a message box about refreshing the lines with no end, one after the other.

Where should I put this code and what should I alter?

Thanks a lot, Frida

You have an infinite loop. So the first validate calls the second validate, which calls the first validate, which calls the second validate, and on and on and on. You would eventually get the insufficient memory message if you clicked through enough messages as well.

Do you have to perform a validate? What is your reason for using validate instead of an assignment ( := )?

Thank you for your answer.

It works perfectly with assignment, there is no need for using validate.