Update Line table from the Header table


I need to automatically update a field in the table Commission Release Line.


Table: Commission Release Header

Field: Sales No.

I add another field in Commission Release Line because there is no “Sales No.” in that table. How can I make it automatically update and get the value in “Sales No.” from Commission Release Header?

Write code In OnInsert Trigger of the Commission line to copy the sale no from the header.

You mean whenever you update SalesNo in Header table the same has to be updated in All Lines table also,right?

What did you ntry this now?

Yes Mohana, actually the “Sales No.” is already there in “Sales No.” (header)., but it is not updating in “Sales No.” in line (the one that I added). I declared RCDCommReleaseHeaderTbl in global to get the Comm. Release Header Tbl. I used this code in

Sales No. - OnValidate()

RCDCommReleaseHeaderTbl.GET(“Sales No.”);

“Sales No.” := RCDCommReleaseHeaderTbl.“Sales No.”;

But it still not updating in the lines

If it’s a part of key in Line Table, you may try set property “TableRelation” on that field.

This update the foreign keys while the parent primary key changes… ( most likely )

in header table or line table or header form or line form trigger?

Read help to know about Get function…when it should be used and how…

Sales No is not your primary key.so u cannot use it in get functoin.

And also investigate whether this can be done via FlowField…

Write code in the “Sales No” -onValidate TRigger of the header.

Filter all the line with same document no and modify them all with Header sale No

Can you give us a sample code?? we dont have idea what to code. :frowning:

CommLine - Variable for Line

“Sales No.”- Onvlidate()

CommLine.getrange(CommLine.“Document No.”,“No.”) // Header “No.”

if CommLine.findfirst then


CommLine.“sale No.”:=“sale No.” // Header Sales No


Until CommLine.next=0

or u can folwfield functionality in the Sales no in the line

Why dont you ask for proper training in office?

When do you learn If we provide code to you?

Hello Ruby,

IF u want to insert sales no in line also wen ever u insert into header, Just make document form and wen ever u insert no in header then it automatically inserts into line by setting subformlink Property.


Thank you for the idea of “SubformLink”.

But What I did is…

  1. Ctrl + F2 in the form of Comm. Release Header

  2. Select the Subform ->Sales Comm. Wksht Line

  3. press F9 then you’ll see the

InsertCommReleaseLine(codPTeamMemberID : Code[20];intPLineNo : Integer;decPCommRate : Decimal;txtPDescription : Text[30])

  • add

recLCommReleaseLine.“Sales No.” := “Sales No.”; - under recLCommReleaseLine.“Release No.” := “Release No.”;

Compile - and it automatically captures the sales no from the header!


InsertCommReleaseLine(codPTeamMemberID : Code[20];intPLineNo : Integer;decPCommRate : Decimal;txtPDescription : Text[30])

intLLineNo := intPLineNo;


recLCommReleaseLine.“Release No.” := “Release No.”;

recLCommReleaseLine.“Sales No.” := “Sales No.”;//inserted by rubi

recLCommReleaseLine.“Line No.” := intLLineNo;

recLCommReleaseLine.“Team Member ID” := recLTeamMember.ID;

recLCommReleaseLine.“Team Member Name” := recLTeamMember.Name;

recLCommReleaseLine.“Team Member Designation” := recLTeamMember.Designation;

recLCommReleaseLine.Description := txtPDescription;

recLCommReleaseLine.“Rate %” := decLCommRatePerc;

recLCommReleaseLine.“Gross Amount” := decLGrossAmt;