Go To items in SmartList provide quick navigation to the windows in the accounting system that allow you to view of modify the selected item. You can add additional Go To items to existing SmartList objects.
Additional Go To items should be added when the SmartList window is being opened. At that time, the resources in the SmartList dictionary will be available so the Go To items can be added. 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_AddCustomerGoTo); if l_result <> SY_NOERR then warning "Focus trigger registration for SmartList failed."; end if;
The trigger processing procedure that runs when the trigger is activated will add the new Go To items to the Customer SmartList object. Use the Explorer_Add_GoTo_Item procedure in the SmartList dictionary to add the new Go To items. When you add a Go To item, you specify the following:
The following trigger processing procedure from the sample integrating application shows how an additional Go To item is added to the Customers SmartList object.
local integer l_error; local string l_message; call with name "Explorer_Add_GoTo_Item" in dictionary SMARTLIST, DYNAMICS, SMARTLIST_OBJECTTYPE_CUSTOMERS, "Contact History", IG_PROD_ID, resourceid(form IG_Contact_History), {Unique ID for this form} false, {Not the default Go To item} l_error; if l_error <> OKAY and l_error <> DUPLICATE then set l_message to getmsg(22002); substitute l_message, "Explorer_Add_GoTo_Item", str(l_error); error l_message; end if;
The additional Go To items you add must be processed by the procedure named Explorer_GoTo_Button that you will add to your dictionary. This procedure must have the following parameters:
inout anonymous field IN_ListView; in integer IN_Object_Dict_ID; in integer IN_Object_Type; in integer IN_GoTo_Dict_ID; in integer IN_GoTo_Item;
The procedure will examine the values passed into these parameters to determine whether it must process the Go To item. If it should, the list view field for the Smart List is passed in as an anonymous field. This allows the code to find the currently-selected line and perform the specified action for that item.
The following is the Explorer_GoTo_Button procedure for the sample integrating application. If the user chooses the Contact History item for the Customers SmartList, this code will find the first selected customer and display the contact history record for that customer.
inout anonymous field IN_ListView; in integer IN_Object_Dict_ID; in integer IN_Object_Type; in integer IN_GoTo_Dict_ID; in integer IN_GoTo_Item; local long selected_item; local string LeadID; local string CustomerID; {Is this the Go To item added to the Customer object?} if IN_Object_Dict_ID = DYNAMICS then if IN_Object_Type = SMARTLIST_OBJECTTYPE_CUSTOMERS then if IN_GoTo_Item = resourceid(form IG_Contact_History) then {Try to find the first customer selected in the list} selected_item = ListView_SelectionGet(IN_ListView, 1); if selected_item <> 0 then CustomerID = ListView_ItemGetLabel(IN_ListView, selected_item); open form RM_Customer_Maintenance; 'Customer Number' of window RM_Customer_Maintenance of form RM_Customer_Maintenance = CustomerID; run script 'Customer Number' of window RM_Customer_Maintenance of form RM_Customer_Maintenance; open form IG_Contact_History; 'Customer Number' of window 'Contact History' of form IG_Contact_History = CustomerID; run script 'Customer Number' of window 'Contact History' of form IG_Contact_History; end if; end if; end if; end if;