Defining a custom query for the Handheld WMS
The following is a tutorial on how to create a custom query for the Handheld WMS client. Custom queries are only available with the Handheld client and Cadacus Solutions release dated after 2/7/2025, the latest Support Library must also be installed.
Defining the query
In the Shipping Setup on the Business Objects/Handhelds tab there is the availablity to define up to 10 custom queries. For each query the following must be defined
- Name - This is the name of the query using in the menus
- Function - This is the scripting function which will be called (see below)
- Prompt - This is the prompt on the screen when the query is selected
- Input - To assist with proper entry of information, one of the preset types may be selected or the "Custom" option can be used and the Handheld WMS client will not attempt to check the input
Writing the query script
Any text editor can be used to write a script and any file naming convention may be used with the exception of spaces-- do not use spaces in the script file name. Generally VB Scripts should use the ".vbs" extension, but this is not required. The script file consists of the script functions as designated in the Shipping Setup. The default Handheld WMS script file is "Handhelds.vbs" in the default script folder as designated by the scripting settings in the files and paths tab of the main system setup.
Notes:
- Do not place any VBScript commands outside of a function in the script. These commands will execute upon the initialization of the script and may cause problems. Also, do not write anything to the screen or attempt to ask any questions of the user as these will not work and may cause the system to halt.
- There can be multiple functions in the same script file.
- Any changes to a script requires the Cadacus WCF service to be restarted.
- Please do not use MsgBox or anything else requiring a user interaction in a live, production script as the script will cause the operation to crash.
Set-up Details
In the EDI System Setup, select the "Files & Paths" tab and check the "Enable Scripting" box. Enter a directory on the SYSPRO application server where the scripts will be stored.

Notes:
- do not use a path with spaces in the directory name(s). If the path does include a space, use the "short' name for the directory with the space in it, for example, "progra~1", instead of "Program Files"
- Use the "Server" option
- To temporarily disable scripting, uncheck the "Enable Scripting" box
- If SQL is used in the script, enter the username and password here, as well (note, the password is hidden after the window is saved and closed)
- Note: If using SYSPRO 8 and scripting on the server is desired, please read this note.
Create a function in the script file matching the function in the query setup. Note: If using the default Handhelds.vbs script is not desired an alternate file may be used by entering the function in the setup as {script file}|{function}. For example a function of "CustomQuery" will call the function CustomQuery in Handhelds.vbs. A function of "Query.vbs|CustomQuery" will use the script file Query.vbs. The script function must accept one parameter which is the user input on the query page. It returns either a fully formed HTML page or an XML to be processed by a XSL translation file.
Function CustomQuery(Input) CustomQuery = "<html><body>You asked for information on : " & Input & "</body></html>" End Function
Please see the standard Handheld WMS server side scripting tutorial for more details.
If the function returns a fully formated HTML page then no further setup is required. In order for the system to understand HTML is being returned the tag <html> or <HTML> must be used. The HTML may reference the default CSS file by adding the following line into the returned HTML in the <head> section.
<link rel="stylesheet" type="text/css" href="/Query\Query.css"/>
If the function returns XML, then a XSL translation file with the same name as the function should be placed in Handheld WMS Query\Local folder on the server. As an example see the CustomXML function and it's associated XSL file below.
CustomXML function in the Handhelds.vbs file :
Function CustomXML(Input) CustomXML = "<RootTag><Item><Details>" & Input & "</Details></Item></RootTag>" End Function
CustomXML.xsl file placed in the Query\Local folder on the server :
<?xml version="1.0"?> <xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform" version="1.0"> <xsl:template match="/RootTag"> <html> <head> <meta name = "viewport" content = "user-scalable=yes, width=device-width"/> <link rel="stylesheet" type="text/css" href="/Query\Query.css"/> </head> <body> <xsl:apply-templates/> </body> </html> </xsl:template> <!-- Start of main section --> <xsl:template match="RootTag"> <div align="center"> <table class="borderall" width="100%" border="0"> <tr> <td colspan="2" class="heading">Stuff</td> </tr> <xsl:for-each select="Item"> <tr> <td class="detailodd"><xsl:value-of select="Details"/></td> </tr> </xsl:for-each> </table> </div> </xsl:template> </xsl:stylesheet>