GetParam (Magic xpa 4.x)

« Go Back


Created BySalesforce Service User
Approval Process StatusPublished

GetParam (Magic xpa 4.x)

Retrieves the value of a global parameter (set with the SetParam function) or the values passed as parameters to programs using a hyperlink or Call Remote command.


GetParam (parameter name)


parameter name: A string representing the name of a global parameter.

If the parameter was set by the SetParam function, the name should be the same as that used in the SetParam function.

If the parameter was received by passed arguments from a Call Remote command, the name should be MGARG##, where ## represents the sequential number of the required parameter. The name MGARG0 returns the number of passed arguments.

If the parameter was received by passed arguments using a hyperlink, the name can either be MGARG##, as in the Call Remote command, or the given name of the passed argument, as specified in the hyperlink or Submit Form operation.


Data according to the data type that was defined in the parameter.


Returns the value of the global parameter 'MyArgument' set by the SetParam function or passed by a hyperlink.

Returns the number of passed arguments in a Call Remote command or hyperlink.

Returns the value of the first argument.

GetParam ('MGARG2')
Returns the value of the second argument.

Returns the value of the argument number (#).

SetParam and GetParam:

SetParam(‘P_DATE’,EOM()+1) creates a variable in the memory called P_DATE, which is a Date variable containing the value of the 1st day of the next month. You can then use the expression GetParam(‘P_DATE’) to initiate date fields with the value from memory instead of using the same expression again. Think of it as a new way to send parameters between two (or more) programs.


Unexpected results may occur if the parameter and variable data types are incompatible.

The function will return NULL where the parameter name is not defined.

In a Magic xpa program called by a hyperlink:

1. The program may receive HTTP environment variables as global parameters that can be accessed by the GetParam function.

2. Sequential retrieving of arguments using the 'MGARG##' convention can only be used if the Arguments value is specified in the HTML form or hyperlink and contains the comma delimited arguments names.

3. If the value starts with -A or -N, these prefixes will be removed from the value since they are directives to the engine regarding the value type. If you want them to remain, change your HTML page to have an additional hidden input field that is updated with an additional prefix, for example: -A-Aabcd. This can be done by using a JavaScript function to update a hidden additional field as follows:

function confirm() {

document.getElementById("Username1").value = "-A" + document.getElementById("Username2").value;


You can then call this function by adding the following to the form tag in the HTML page: onsubmit="return confirm();".

See also:



The Online and Rich Client Samples projects (program TF10 and RTF10)