RE: May I know what is the use of OnAssistEdit trigger.
Example from the base app from the contact card page below. It largely depends on what UX you want. Lookups have a dropdown menu displayed. Whereas an assist edit opens a pre filtered chosen page:
field(Name; Name)
{
ApplicationArea = All;
AssistEdit = true;
Importance = Promoted;
ShowMandatory = true;
ToolTip = 'Specifies the name of the contact. If the contact is a person, you can click the field to see the Name Details window.';
trigger OnAssistEdit()
var
Contact: Record Contact;
begin
if "No." = '' then begin
Insert(true);
Commit;
end;
Contact := Rec;
Contact.SetRecFilter;
if Contact.Type = Contact.Type::Person then begin
Clear(NameDetails);
NameDetails.SetTableView(Contact);
NameDetails.SetRecord(Contact);
NameDetails.RunModal;
end else begin
Clear(CompanyDetails);
CompanyDetails.SetTableView(Contact);
CompanyDetails.SetRecord(Contact);
CompanyDetails.RunModal;
end;
Rec := Contact;
CurrPage.Update(false);
end;
}