Unable to update field data value from one table to another table

Hi all,

I have extended my Purchase Header table and Page to include Job No. and Job Description fields and what I need is when I pick the Job No on the Purchase Header page, my custom fields on Job page should be updated the vendor no and Vendor name from the Purchase order. I have put all my code inside OnValidate trigger but immediately I pick the job no and description on my Purchase Order page and save, my job card window fields are not updated. Below is the extract of my code.

field(200; "ProjNo."; Text[30])
        {

            Caption = 'Project Number';            

            DataClassification = ToBeClassified;
            TableRelation = Job."No.";
            
            trigger OnValidate()


            var
                JobHeader: Record 167;


            begin
                
                JobHeader.Get("ProjNo.");
                "Project Name" :=JobHeader.Description;

                if "Project Name" = JobHeader.Description then 
                   begin
                   JobHeader.Reset();
                   JobHeader.SetRange("No.","ProjNo.");
                   if JobHeader.FindLast then 
                   //Repeat
                   if JobHeader."Consultant"= '' then
                      JobHeader.Contractor:="No.";
                      Jobheader.Consultant:="Buy-from Vendor Name";

                   end;             

            end
             
           
        
    
        }
Kindly assist to sort this.
Related
Recommended