I am trying to create a "Received" bool field on both the Purchase Lines and the Sales Lines, so that when an item is marked as True on the Purchase Line, the linked Sales Line is also marked as True. So far I have managed to create a field on the Purchase Line to store the id of the associated Sales Line, but I am having a little trouble figuring out the Trigger for when the Purchase Line field is changed and how to use the Sales Line id field to update the specific Sales Line that matches the id.
field(csg_PoliReceived; Rec.csg_PoliReceived)
{
Caption = 'Purchase Order Line Received';
ApplicationArea = All;
trigger OnValidate()
begin
// if true
// update Sales Line to true
// if false
// update Sales Line to false
end;
}
I have this snippet in a pageextension that extends the Purchase Lines page, so I am not exactly sure how to query for the Sales Line with the matching Id and how to update that record. Any advice would be much appreciated. Thanks!