Defining a custom form for the Handheld WMS

The following is a tutorial on how to create a custom form for the Handheld WMS client. Custom forms are only available with the Handheld client, Cadacus Solutions and support library release dated after 4/20/2025.

Defining the forms

To define the forms an XML file called CustomForms.xml must be created and placed in the Handheld solution Resources\Local folder on the server. The format of the XML file is as follows :

<CustomForms>
<CustomForm>
<Title>Scan Comparison</Title>
<Function>ScanCompare</Function>
<Fields>
<Field>
<Name>Scan1</Name>
<Prompt>First Scan</Prompt>
<Required>Yes</Required>
<Sticky>Yes</Sticky>
</Field>
<Field>
<Name>Scan2</Name>
<Prompt>Second Scan</Prompt>
<Required>Yes</Required>
</Field>
</Fields>
</CustomForm>
</CustomForms>
  • CustomForms - Root XML level
  • CustomForm - Definition of a form (multiple CustomForm sections may be defined to create multiple forms)
  • Title - Title to be displayed on the menu button and the top of the form
  • AutoPost - "Yes" or "No" - If set to Yes the form with automatically post when all fields are filled in
  • Fields - Definition of the input fields
  • Field - Definition of an input field
  • Name - Name of the field to be passed to the script (must be unique)
  • Prompt - Screen prompt (an ":" will be added automatically)
  • Required - "Yes" or "No" - If set to Yes the field can not be left blank
  • Sticky -  "Yes" or "No" - If set to Yes the field will not be cleared after a post.

The sample above sets up a custom form called "Scan Comparision" with two fields "First Scan" and "Second Scan", they are both required and the first field will not be cleared after a post.

Writing the form script

Any text editor can be used to write the 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 XML. 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.

Warning:  scripts must be carefully tested as the Handheld WMS system does no validation on the returned information.

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 XML file. 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 "CustomForm" will call the function CustomQuery in Handhelds.vbs.  A function of "Forms.vbs|CustomForm" will use the script file Forms.vbs. The script function must accept one parameter which is the user input on the custom form. The script must return a valid XML string as defined in the standard Handheld WMS server side scripting.

Function ScanCompare(Input)
  Scan1 = HandheldWMS.ElementText("Scan1")
  Scan2 = HandheldWMS.ElementText("Scan2")
  
  if Scan1 <> Scan2 then
    ScanCompare = HandheldWMS.ReturnProblem("Scans are not equal")
    exit function
  end if
  
  sqlcmd = "INSERT INTO ScanCheck ([User],[ScanDate],[Scan1],[Scan2]) VALUES ('" & HandheldWMS.Employee & "',GETDATE(),'" & Scan1 & "','" & Scan2 & "')"
  nRecs = HandheldWMS.SQLExecuteNonQuery(sqlcmd)
  
  ScanCompare = HandheldWMS.ReturnSuccess("")
End Function

Please see the standard Handheld WMS server side scripting tutorial for more details.