Checking action access

The actions in the Action Pane are enabled or disabled automatically, based on the number and specific type of lines the user has marked in the list. Microsoft Dynamics GP tracks two counts for every action in the Action Pane. The “count for” counter tracks the number of items marked to determine whether the single-select or multi-select actions should be enabled. The “count against” counter tracks the number items marked that would prevent an action from being enabled. If there are any “count against” lines marked, the action will be disabled.

For example, assume that the Qualify action can be performed for the items selected in the list. This action would be active as long as the user has marked one or more items to qualify. However, if the user marked an item that had already been qualified, the “counts against” counter would be incremented, causing the Qualify action to be disabled.

How you specify actions access for the Action Pane items depends on whether you are adding actions to your own list or to an existing Microsoft Dynamics GP list.

Checking action access for your list

If you are creating your own list, you will check the acction access for the items added to the Action Pane using one of the procedures provided for the list. For card lists, this is described in Action Pane. For transaction lists, this is described in Action Pane.

Checking action access for a Dynamics GP list

If you are adding your actions to a Microsoft Dynamics GP list, you will register a trigger for the CheckActionAccessForRecord procedure of form that is used for the list. The trigger processing procedure will define the access behavior for the actions being added.

You can refer to the script parameter documentation in the Microsoft Dynamics GP SDK to see the set of parameters used with each CheckActionAccessForRecord procedure.

The following example is a portion of the Startup script for the sample integrating application. It registers the trigger for the CheckActionAccessForRecord procedure of the ListObj_Customers form used for the Customer list.

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

The trigger processing procedure is called once each time a user marks or unmarks a line in the list. The procedure specifies how the item marked or unarked in the list should be considered when determining whether the action should be accessible. You will use the 'Table Reference' component of the list object composite passed into the procedure to determine which row is being marked or unmarked in the list.

The parameter value returned through the “out” parameter this trigger processing procedure specifies how the marked row should be considered. The value corresponds to one of the following constants:





The marked row won’t affect the count for the action.


The marked row will increase or decrease the “count for” counter by one.


The marked row will increase or decrease the “count against” counter by one.

For example, the following trigger processing procedure updates the action access for two actions added to the Customer card list. Notice how the Inactive field from the row being marked or unmarked is examined to determine which access counter should be incremented or decremented.

in ListObjState list_object;
in integer nActionCmdTag;
out integer nAccessStatus;

if nActionCmdTag = Command_GetTag(command IG_Contact_History of form Command_IG_Sample) then
end if;

if nActionCmdTag = Command_GetTag(command IG_Update_Contact_Date of form Command_IG_Sample) then
	{Is the customer active?}
	if 'Inactive' of table (list_object:'Table Reference') = true then
		{Customer is inactive, so disable the action}
		{Customer is active, so count for enabling action}
	end if;
end if;

Documentation Feedback