Sample Scripts

 

You can download the scripts described on this page from the source forge project site here.

Some of the scripts are really simple to a point where they may not do desirable things for production use. They can all just be loaded into the database if desired but would have to be loaded them with the correct name for the screen you want them to work on. The names they have are more informational as to what they do, in most cases, rather than the name they should be called when loaded in the database.

  • addButton.script - This can be added to any window that has a button called _delete and simple adds a button after the _delete button that when clicked shows a message box with a message. You can load this into a database with the name "accountNumbers" then you can see the results on "Accounting | Account | Chart of Accounts..."
  • connectFunctions.script - This can added to any window that has a button called _new and will connect the clicked action of that button to the script function defined that changes the name of the _new button to New1, New2, etc... after each click while the window is open. This can also be added to the "accountNumbers" screen.

  • disableDscntPrice.script - Disables users from editing the Discount from price information on "salesOrderLine" screen.

  • disableObject.script - Shows two ways you can disable an object on a screen. Specifically this one uses _new object name and can loaded against "accountNumbers".

  • discountSameProdcat.script - This script will automatically give a discount to a sales order line item if it is in the same product category as any other existing line item on the sales order already. This can added on "salesOrderLine".

  • hideSalesrepComm.script - This will hide the Salesrep commission information the screen "salesOrder".

  • initMenu.script - this script is loaded as "initMenu" and these named scripts are run when the application first started. This scripts specifically shows how to find and disable a menu item, specifically "Products | Item | New...", opens the Item Site list screen and opens the Opportunity Types screen.

  • soitemJumpWomatl.script - This script should be added to "salesOrderItem" screen and will add a new button called "W/O Matl." that when clicked will open the Maintain W/O Material screen if the Sales Order Item has a child Work Order associated with it.

  • windowSetTitle.script - This script shows simple how to change the title of screen. This will work on any screen but the script sets the title to an alternating case for Opportunity Types so makes the most sense on "opportunityTypes" screen.

  • sampledisplay.script, sampledisplay.ui ,telephonelookup.script ,telephonelookup.ui - These scripts and forms can be added as the same names as the file or whatever names you choose. Just make sure the names you load the ui file as and script file are the same as they are paired to work together. If you load the script and form you can test the form from the UIForm list window however if you want to add a custom menu item you will need to create a custom menu item. In this case you could create a custom command with the command "!customuiform" and the argument 0 of "uiform=Calculator" and the argument 1 of "uiformtype=dialog" or "uiformtype=window" if you want the screens as modal dialog or window respectively.

The above with the scripts for the custom command will put the command in a "Custom" sub menu for the specified module choosen. You can use some additional scripting to add a new menu item elsewhere that is a link to the custom menu item and optionally hide the custom menu item so it looks more intergrated. To do you would want to make sure you specify an action name for the custom command you created so you can find it using the script then add this "initMenu" script.

// find the name of an existing menu we want to add to end of
var menu = mainwindow.findChild("menu.prod.items");
// the commandname is always appended with custom.
var trig = mainwindow.findChild("custom.mycustomactionname");
// create our custom menu item
var act = toolbox.menuAddAction(menu, "My Custom Menu item");
act.triggered.connect(trig, "trigger");
// optionally hide the original item
trig.visible=false;