Working with parameters

A procedure that runs in response to a function trigger can’t have any parameters. The procedure does not have access to the parameters for the original function. A function that runs in response to a function trigger must have the same set of parameters as the original Microsoft Dynamics GP function. As a result, the function has access to the original function’s parameters. The following table shows how function parameters and return values are used for function triggers.



Function call



set result to OrigFunction(parameters)

A script calls the original function for which triggers have been registered. The function triggers and function run in the following manner:


return_value PreTriggerFunction(parameters)

The pre trigger processing function runs.


return_value OrigFunction(parameters)

Next, the original function runs. The parameters from the pre trigger function are passed to the original function. Any changes the pre trigger function made to the parameters will be seen in the original function.


return_value PostTriggerFunction(parameters)

Then, the post trigger processing function runs and the parameters from the original function are passed to it. Any changes the original function made to the parameters will be seen by the post trigger function.



Finally, the resulting parameter set and return value are returned to the original calling script. If the post trigger function doesn’t set the return value, the original function’s return value will be returned.

Example 3: Using a trigger processing function

The following trigger processing function runs in response to the form-level function named SaveRecord (registered in example 2). Since this is a function rather than a procedure, it must have the same parameters as the original function. It also has access to those parameters.

The SaveRecord function includes two parameters: a boolean parameter named Status that specifies whether the checkbook record saved, and an inout parameter for the current checkbook record. The following trigger processing function uses these same parameters, and has access to the values of both.

It first checks the Status parameter to ascertain whether the function successfully saved the checkbook record. It then checks the Maximum Check Dollar in the current record; if it’s greater than $10,000, it displays a warning, then opens a third-party form for setting security access to the checkbook:

{Name: IG_Verify_Checkbook}
function returns boolean Status;

inout table CM_Checkbook_MSTR;

if Status = true then
	{The table save occurred.}
	if 'Maximum Check Dollar' of table CM_Checkbook_MSTR > 10000 then
		warning "Please set up checkbook passwords for this checkbook.";
		open form IG_Checkbook_Security;
	end if;
end if;

Documentation Feedback