Auto populate data in a field on a page.

mysamzamysamza Member Posts: 66
I have a table with the following fields;
fields
{
field(1; "Document Nos."; Code[20])
{
}
field(2; Employee; Code[10])
{
TableRelation = Employee;
}
field(3; "Pay Code"; Code[10])
{

}
field(4; Currency; Code[10])
{

}
field(5; Amount; Decimal)
{

}
field(6; "Posting Date"; Date)
{

}
field(7; "Employee Name"; Text[50])
{

}
}

The Employee field is a lookup to the Employee table. Notice the field Employee Name (field 7)
Once the user selects an Employee from the Lookup, I want the Employee name to populate with the value of Employee Name from the Record user selected in the Employee (field 2)

I am omitting the code for the Card Page for this table as it is straightforward. Just has the same amount of fields that are in the table I posted above.

I look for a hint as to how do I go about achieving this.

Thanks a lot in advance for the help.

Answers

  • PottiPotti Member Posts: 11
    trigger OnValidate()
    begin
    ...
    end;

    You can add an OnValidate Trigger in your Employee field.
    The OnValidate Trigger will get triggered after you enter a value to a field.
  • SunsetSunset Member Posts: 201
    Also decide if you want the field to be a flowfield, or if the users should be able to edit it after it has been populated.
    Don't just take my word for it, test it yourself
Sign In or Register to comment.