How To Use Global Variables
Some explicit steps can reference fields called Predefined Values. In addition to referencing an ad hoc constant value (e.g., the letter Y), you can also reference a global variable in such a field value. A global variable is used when you want to reference system data.
Note that when using the Edit Data step type, the variable available are slightly different. Refer to Edit Data Syntax for details.
The following global variables exist for BPA scripts:
Variable Name | Comments |
---|---|
%PARM-<name> | This is the value of a parameter of that name passed in to the application when launched via the standard system URL. Refer to Launching A Script When Starting the System for more information on these parameters. |
%PARM-NOT-SET | This is to be used to compare against %PARM-< > parameters to check if the parameter has been set or not when the application was launched. A parameter that has not been set would be considered equal to this global variable. It is recommended to compare parameters against this global variable before using them for the first time. |
%BLANK | A constant that contains a blank value (no value). |
%SPACE | A constant that contains a single space value. |
%CURRENT-DATE | The current date as known by the browser, not the server. |
%SYSTEM-DATE | The server date. Note that this date is affected by the system date override logic) |
%SAVE-REQUIRED | A flag that contains an indication of whether the data on a page has been changed (and thus requires saving). You may want to interrogate this flag to force a user to save their work before executing subsequent steps. This flag will have a value of TRUE or FALSE. |
%NEWLINE | A constant that contains a new line character (carriage return).
Upon substitution, a line break is inserted in the resultant text. Note: This constant does not have the desired effect when the resultant
text is HTML. For example, a step's text and prompt strings. This
is because HTML ignores special characters such as new lines. Refer
to How To Use HTML Tags And Spans In Text to learn how to cause
a line break in an HTML text.
|
To refer to a global context variable, use %FIELD_NAME. For example, if the field SP_ID is in the global context, you may reference %SP_ID to reference the ID of the service point currently in context. In addition, the following special values are supported:
Variable Name | Comments |
---|---|
%CONTEXT-PERSONID | A constant that contains the ID of the current person. |
%CONTEXT-ACCOUNTID | A constant that contains the ID of the current account. |
%CONTEXT-PREMISEID | A constant that contains the ID of the current premise. |
In addition, if the script is invoking something else via one of the various “Invoke” step types and an error is returned, the following global variables contain information about the error:
Variable Name | Comments |
---|---|
%ERRMSG-CATEGORY %ERRMSG-NUMBER | The unique identifier of the error message number. |
%ERRMSG-TEXT | The brief description of the error. |
%ERRMSG-LONG | The complete description of the error. |