RunGlobalProcedureOnServer
- Last UpdatedOct 29, 2026
- 2 minute read
The function RunGlobalProcedureOnServer runs a specified VBScript procedure, as defined in the Procedures folder in the Project Explorer. The procedure is run on the project runtime server, but it can be triggered by any client that calls this function.
|
Function |
Group |
Execution |
String Exp. |
Windows |
Windows Embedded |
IoT View |
Thin Clients |
Mobile Access |
|---|---|---|---|---|---|---|---|---|
|
RunGlobalProcedureOnServer |
Module Activity |
Synchronous |
No |
Supported |
Supported |
Not supported |
Supported |
Supported |
Syntax
RunGlobalProcedureOnServer(strProcedureName, optStrArgument1,…, optStrArgumentN)
strProcedureName
The name of the procedure (a VBScript function or subroutine defined in the VBScript Global Procedures) to run on the project runtime server.
optStrArgument1,…,optStrArgumentN
Values that are passed to the procedure's parameters. Arguments must be passed as strings, but the procedure will interpret them as the correct data types. For more information, see "Examples" below.
Returned value
This function returns whatever value that is returned by the procedure.
Notes
If the Enforce Web functionality equivalence in local project screens option is selected in the project settings, this function cannot be called in VBScript Global Procedures, VBScript scripts (script groups), or other background tasks. This is because the function behaves differently depending on whether you view project screens locally (that is, on the same computer that hosts the project runtime) or remotely. For more information, see Preferences tab.
Also, you cannot call this function in a procedure that was itself run by calling the function RunGlobalProcedureOnServer. If you attempt to do so, then the function will return an error. This is to prevent a possible memory leak caused by nested or recursive function calls.
You can still call other procedures directly, as you normally would in VBScript, or you can use the function Eval in VBScript to dynamically determine the procedure you are calling.
Examples
Given the following procedure that is defined in the Procedures folder…
Function AddMe(intNumber)
If intNumber >= 6 Then
AddMe = 0
Else
AddMe = intNumber + 2
End If
End Function
…the procedure is run by calling the function RunGlobalProcedureOnServer…
RunGlobalProcedureOnServer("AddMe", "2")
…and it returns a value of 4.