purchase order validation

Hi all!!! i want a validation in my purchase order that if it gets a value in Purchase price of the specific item then it should not be changed in the direct unit cost, other wise it should allow to enter a value in the PO line. i have written the below written code on the onvalidate of direct unit cost:-

IF CurrFieldNo = FIELDNO(“Direct Unit Cost”) THEN BEGIN

IF(“Document Type”=“Document Type”::Order) AND (xRec.“Direct Unit Cost” <> “Direct Unit Cost”)

THEN ERROR(‘Direct unit cost cannot be changed.’); END;

please help to add the code for checking the price in purchase price table.

Hi Yuneek,
Not sure exactly what you want to archive with this? Just make the field not editable if you don’t want users to change it.

you can create a Boolean and activate I when price is calculated and added in price fields.
use that field while changing manually.

no but there are also items for which price cannot be fixed in price table , so it would be entered manually rest would come from price table,

can you please explain in detail?