xTuple ERP supports QtScript, a tool for loading UI forms using ECMAScript based language files for creating and modifying application functionality without the need to recompile. To take advantage of this functionality, one should have a basic understanding of how to program using ECMAScript and create UI screens using QtDesigner.
To learn more about scripting for xTuple ERP, please see the Scripting Guide.
To view the master list of available scripts, select the "Scripts" option. The following screen will appear:
The scripts master list displays information on all stored scripts, including script name, description, order, and enabled status.
To the far right of the screen, the following buttons are available:
Closes the screen, returning you to the application desktop.
Opens screen for adding a new script to the scripts master list.
Enables you to edit highlighted scripts. The edit screen is the same as that for creating a new script—except that when editing, the fields will contain script information.
Highlight a script and then select this button to remove the script from the master list.
To create a new script, select the NEW button. The following screen will appear:
When creating a new script, you are presented with the following options:
Enter a name to identify the script. The name of the script must match the name of the screen the script will be used for. If the script name does not match the screen name, the script will not be used. Because a single screen may require more than one script, you may save multiple scripts having the same name. The order, notes, and content of each script will distinguish one from the other.
Enter a brief description of the script.
Specify the order in which the script should be run. The script having the lowest number (i.e., "0") will be run first, and then following scripts will be run in consecutive order.
Select to enable the script. If not selected, the script will be disabled. A disabled script will not be run when the corresponding screen is executed.
Enter the content of the script using QtScript. You may type the script directly into this window, or you may import a script using the IMPORT SCRIPT button.
To the far right of the screen, the following buttons are available:
Closes the screen without saving any changes.
Saves the script and adds it to the scripts master list.
Select to import a script from your local file system into the database. This option is useful if you prefer to do your scripting using an external script editor. The script you import will be shown in the script window.
Every time you import a script file, the new script will replace the script which was shown in the script window previously.
Select to export the script shown in the script window to your local file system. You would use this option if you need or want to edit the script and do not have a copy stored locally on your system. Once exported, the script can be edited using an external editor—and then re-imported into the database using the import option. Whenever you import a script file, it automatically replaces whatever script was in place before it.