trouble with local function updating a field

blhblh Member Posts: 24
I am trying to write a function that updates the Sales Freight Amount field in the Sales Header table when a Menu Item is pushed from the Sales Quote form. I created a local function in the form with the following code:

CalcSalesFreightAmount(VAR SalesHeader : Record "Sales Header")
SalesHeader.GET("Document Type","No."); //get current record from Sales Quote form
SalesHeader.CALCFIELDS("Total Net Weight"); //calculate Total Net Weight flow field
SalesHeader."Sales Freight Amount" := SalesHeader."Frt per CWT" * (SalesHeader."Total Net Weight"/100); //calculate Sales Freight Amount

In the OnPush trigger is the following code:

CalcSalesFreightAmount(SalesHeader);

When I push the Menu Item the Sales Freight Amount does not update. I checked to make sure that there is a value in the Frt per CWT and Total Net Weight field (A flow field which calculates the total net weight of the items from the Sales Line). I know that I'm probably making some simple rookie mistakes. This is the first function I've ever tried to write. If anyone can help or point me to a form that uses a local function to do something similar (so I can do a little creative plagiarism) please let me know. Thanks in advance!
BLH

Answers

Sign In or Register to comment.