Global ProcScripts

Global ProcScripts are global objects that are located in a runtime library and can be called from any ProcScript in the application. They enable you to define common functionality for use by one or more applications.

Unlike IncludeScripts, which are used only during development to inject a copy of the code during compilation, global ProcScripts are linked into components at runtime. This enforces a runtime dependency—the global ProcScript library in which they are located must be deployed along with the components that call or use the global ProcScripts. For this reason, it is usually preferable to use IncludeScripts.

It is also possible to copy a global ProcScript into a component during compilation using the #entry precompiler directive, so that it is treated as a local ProcScript module.

Global ProcScripts are defined as development objects in a Global ProcScript library, and compiled into a deployable runtime library.

Each global ProcScript is an implicit entry module, which can be used as a private function, or executed in response to a call statement. Global ProcScripts can contain other entries, but these should be placed after all other code in the module.

To write generalized global ProcScripts, you can get information about the caller context using functions such as $applname, $formfocus, $entname, $entinfo, $fieldname, and $fieldinfo.

Do not use pre-defined Uniface constants in global ProcScripts, because during compilation global ProcScripts do not have access to the information required to correctly resolve the constants.

Related Topics