A new SmartList object should be created when the SmartList window is being opened. At that time, the resources in the SmartList dictionary will be available so the new object can be added. A focus trigger is typically used to indicate when the SmartList window is being opened. The trigger processing procedure will define the new SmartList object.
The following example is a portion of the Startup script for the sample integrating application. It registers a focus trigger for the ASI_Explorer form which is the main form for the SmartList. Notice that the trigger is registered by name, since the form is located in the SmartList dictionary, not the core dictionary.
l_result = Trigger_RegisterFocusByName(SMARTLIST, "form ASI_Explorer", TRIGGER_FOCUS_PRE, TRIGGER_AFTER_ORIGINAL, script SmartList_CreateLeadObject); if l_result <> SY_NOERR then warning "Focus trigger registration for SmartList failed."; end if;
The trigger processing procedure that runs in response to this trigger performs several tasks. It uses the Explorer_Add_Object procedure to define the new SmartList object. It also adds columns and Go To items to the new object. To simplify the code, these actions are usually performed in separate procedures.
The following is the trigger processing procedure that creates the Leads SmartList object for the sample integrating application. Each new SmartList object you create must have an ID that is unique for your product. This ID will be used throughout the code for the new SmartList object, so you will want to create a constant for the ID. For the Leads object, the constant SMARTLIST_OBJECTTYPE_LEADS was created. The columns and Go To items for the new SmartList object are added in separate procedures.
Procedure name: SmartList_CreateLeadObject
local integer l_error; {Create the new SmartList object} call with name "Explorer_Add_Object" in dictionary SMARTLIST, IG_PROD_ID, SMARTLIST_OBJECTTYPE_LEADS, "Leads", l_error; if l_error <> OKAY and l_error <> DUPLICATE then error "Error creating Lead SmartList object"; end if; {Add columns to the SmartList} call SmartList_CreateLeadObjectColumns; {Add the GoTo to the SmartList} call SmartList_CreateLeadObjectGoto;