Problem Statement
Maximo allows future dates to be entered into some application date or date-time fields. For some business processes, future dates should not be allowed.
In the Work Order Tracking application, Reported Date can be specified as a future date which does not make much sense when the work order is being created.
Solution
Implement a business rule using Attribute Launch point that performs a date check on the entered / chosen date and time value for the field and throws an error message if the date is set in the future.
Technical Approach
Unlike most scripting approaches, for this particular implementation, we first implement the automation script. This is because the logic in the script to check the entered date is independent of which application and which field the value was retrieved from. Multiple launch points can be associated with the one common script.
APIs used:
- MXServer.getMXServer()
- MXServer.getDate()
Script code in the form of a PY file (futuredates.py) is attached to this article here.
PDF version of this article is attached here.
Implementation Details
The script must throw an error message. This message is defined using the Messages facility of Database Configuration application. For our example, we have used 'system' as the message group and 'baddate' as the message key.
- Using the Automation Scripts application, execute the Create Script action. In the dialog box that's displayed enter Script name, description, a single IN variable called 'myvalue' and code as shown below.

- Author the script code (SAMPLE SCRIPT, NOT FOR PRODUCTION USE):

Script logic is very simple. Script compares the date value specified / selected by the user (retrieved as input variable myvalue) with the current date and time as retrieved by the global MXServer system object. If the entered date and time value is greater, an error message is pushed to the application's user interface. Click Create to save the script definition.
- Associate the newly defined script with the desired Attribute launch points. In this example, the script is associated with the WORKORDER object's REPORTDATE attribute. In Step 1 of the Attribute Launch point wizard, specify Object as WORKORDER, Attribute as REPORTDATE. Instead of selecting the New Script option, the Existing Script option is chosen and the previously created FUTUREDATES script is chosen.

- In Step 2 of the Attribute Launch point wizard, bind the previously declared 'myvalue' variable to the WORKORDER object's REPORTDATE attribute. This explicit binding is required for each launch point that will apply this date check business rule. This is because the script itself and the associated variable must remain generic. The rule will be applied to different attributes of different objects.

In Step 3 of the wizard the script code is displayed since we chose an existing script. Click Create to complete creation of the new launch point.
- Since the Attribute launch point WORPTDATE is active, when a future date is entered into the Reported Date field of Work Order Tracking, an error message is shown that manifests as standard field validation error:

- In our implementation we associated the common script to two different launch points as shown below:

In the case of the DELIVERY launch point against PO business object, the variable binding is to the REQUIREDDATE attribute of PO.
Script Take aways
Business rules that essentially implement the same logic can be authored as a common automation script. Multiple launch points can be defined that point to the same common script.
In the date check implementation, we utilized Maximo's public MXServer.getDate() API which is globally available from the MXServer object. This API returns the current system date and time that is used in all of the product environment.