IF PurchaseRequestDetails."Unit Price LCY" = 0 THEN ERROR('Unit Cost must have a value in Purchase Request Details: Request No.=%2, Line No.=%3. It cannot be Zero or empty.', PurchaseRequestDetails."Request No.", PurchaseRequestDetails."Line No.");But you should use a text constant for the error message.
Answers
How do you throw the error?
If your record is "Purchase Request Details" and your Field is "Unit Cost" ...
Try
Kindly regards
s_keim
inhouse developer on NAV2016 (9.00.47838) NAVDE
I use this code for catch error when "Unit Price LCY" is empty.
I can not use this code PurchaseRequestDetails.TESTFIELD("Unit Cost") because the field in table named "Unit Price LCY" but on the page this field rename to "Unit Cost". And if "Unit Cost" on page is empty I have to catch this error. But in this error "Unit Price LCY" have to be changed to the "Unit Cost". How I can do it?
if you use the TESTFIELD, you cannot change the error message directly.
But TESTFIELD shows the field caption in the current language.
So if you can change the field caption in the table, do this.
And then you should remove the field caption in the page, so that the page shows the new table field caption.
Otherwise you have to throw the error by code: But you should use a text constant for the error message.
Kindly regards
s_keim
inhouse developer on NAV2016 (9.00.47838) NAVDE