For a condition how I Assign Unit Price:=0 in Sales Order's Line

There have a boolean field( Order Status ) in the Header Tab(General), when the Field is in true condition then if you select the item no. then the unit price must show 0 and Quantity:=15,

I write the following code in OnValidate of No. in Sales Line Table …

SalesHeader3.RESET;
SalesHeader3.SETRANGE(SalesHeader3.“No.”,“Document No.”);
IF SalesHeader3.FINDFIRST THEN BEGIN
MESSAGE('Status %1 ',SalesHeader3.“Order Status”);
IF SalesHeader3.“Order Status”=TRUE THEN //BEGIN
“Line No.”+=10000;
“Unit Price”:=0;
Quantity:=15;
MESSAGE('U.Price %1 ',“Unit Price”);
END;

---------> Here the Quantity is update instantly but the unit price show as base price not assigned as 0.

what should i do?

it depends on where you have written code.
Onvalidate trigger og No. will lead to lot of other functions in codeunits etc.
if your code is at the beginning then it will be overwritten by following code…

Write the below two line of code at the very end of the No. Field’s OnValidate trigger and test you might see what you were looking for by crossing 1 level. There is a function call at the same trigger “UpdateUnitPrice(FIELDNO(“No.”));” just debug it and add your conditional assignment “Order Status” check then assign the values.

“Unit Price”:=0;
Quantity:=15;

Thank you sir, Let me try…

I solve this and your instruction helps me a lot…thank you once again sir.