calculating price of a book

hello everyone

i am using dynamics 365 business central

i have created a table named "book" and page named "bookcard" i have two fields in it price and page count. and i have created a code unit 

codeunit 50143 BookCodeUnit
{
trigger OnRun()
begin
end;

local procedure CalculatePrice()
var
book: Record Book;
begin
book.Price := book.PageCount * 2.5;
end;

}
now i want to know that how can i make that as soon as i fill the field pagecount , then the price appears for that book in the field "price" 
Related
Recommended