Before you use form triggers, you must first register them for use with the runtime engine. The Trigger_RegisterForm() function handles the registration process for a form trigger.
This form trigger runs when the user displays the RM_Customer_Maintenance form. The menu item is “Contact History,” it has no accelerator key, and it calls the procedure named IG_Open_Contact_History.
{Name: Startup} local integer l_result; l_result = Trigger_RegisterForm(form RM_Customer_Maintenance, "Contact History", "", script IG_Open_Contact_History); if l_result <> SY_NOERR then warning "Form trigger registration failed."; end if;
When the user chooses the Contact History menu item, this trigger processing procedure opens the third-party form named IG_Contact_History, sets window fields, and retrieves a record from the Contact History table.
{Name: IG_Open_Contact_History} open form IG_Contact_History; if isopen(form RM_Customer_Maintenance) then 'Customer Number' of window IG_Contact_History of form IG_Contact_History = 'Customer Number' of window RM_Customer_Maintenance of form RM_Customer_Maintenance; run script 'Customer Number' of window IG_Contact_History of form IG_Contact_History; end if;