Executing an action

An action is executed when the user clicks an item in the Action Pane. How you process an action depends on whether you are adding actions to your own list or to an existing Microsoft Dynamics GP list.

Executing actions for your list

If you are creating your own list window, you will use the procedure provided for the list to execute actions for it. For card lists, this is described in Action Pane. For transaction lists, this is described in Action Pane.

Executing actions for a Microsoft Dynamics GP list

To execute your actions for a Microsoft Dynamics GP list window, you will register a trigger for the ExecuteAction procedure for the form that defines that list. The trigger processing procedure will be called when a user initiates an action. This procedure will determine if the action chosen was one you defined, and then run the appropriate code for the action.

The following example is a portion of the Startup script for the sample integrating application. It registers the trigger for the ExecuteAction procedure of the ListObj_Customers form used to implement the Customers list.

l_result = Trigger_RegisterProcedure(script ExecuteAction of form ListObj_Customers, TRIGGER_AFTER_ORIGINAL, script IG_ExecuteCustomerActions);
if l_result <> SY_NOERR then
	warning "Procedure trigger registration failed.";
end if;

The trigger processing procedure that runs when the user chooses an action has a list object variable and an action ID passed into it. You will use the action ID to find out whether this is an action you need to process. If it is, you will use the object variable to access the main table used for the list so you can determine what list item the user has selected.

The following is the trigger processing procedure for the sample integrating application that is activated whenever the user clicks an action in the Action Pane for the Customers list. Notice that the DisassembleDictSpecificID procedure is used to extract the product ID and action. If the action is defined by sample integrating application, it is processed.

inout ListObjState list_object;
in long action_id;

local integer dict_id;
local integer action;

{Is this the default action? If it is, do not process it.}
if action_id <> DEFAULT_ACTION then 

	{Disassemble the action that was passed into the script}
	call DisassembleDictSpecificID, action_id, dict_id, action;

	{Process the action}
	if dict_id = IG_PROD_ID then

		{It is our action to process}
		case action
			in[ACTION_CONTACT_HISTORY]
				{Execute the action to open the selected customer}
				call ExecuteAction of form ListObj_Customers, list_object, DEFAULT_ACTION;

				{Open the Contact History window}
				call IG_Trigger_Open_Contact_History;

			in[ACTION_UPDATE_CONTACT_DATE]
				{Update the contact date for all of the marked customers}
				call IG_Update_Contact_Date, list_object;
		end case;
	end if;
end if;


Documentation Feedback