The conditional expression manager is a useful tool to use to conditionally display or hide data or fields. This helpful trick will show you how to make a field required based on some other values in other fields. In previous version of Maximo, this used to be called Field Control. Now, I know that you can just go into the Database Configuration and set any attribute you want to be required, but sometimes that doesn’t fit all situations. For example, let’s say that we want to make the GL Account field required, now if we had gone into the DB configuration and made that field required at all times and when a workorder is created, if the user entering the workorder doesn’t know the right GL Account to charge against, then the user wouldn’t be able to create the workorder. Unless of course they didn’t care and just put in any value just for the sake of saving the workorder. So in this case, making the GL Account attribute required would not work.
This is where the Conditional Expression Manager comes in. We can set up a rule or condition to say something like this: if the workorder status does not equal ‘WAPPR’ (which is the default workorder status when a new one is created), and the GLAccount field is null or empty, then evaluate the rule or condition to true, otherwise the rule is false. And depending on whether the rule returns true or false, you can do certain things like make the GL Account field required. So in this scenario, when are user creates a new workorder with a NULL GL Account value, since the default status is ‘WAPPR’, this rule will return false, therefore not making the GL Account field required. Now if this user where to go ahead and try to change the status to ‘APPR”, the rule would evaluate to true, and the user will see an message saying the GL Account field is required.
First, here is a brief explanation of what the Condition Expression Manager does:
You use the Conditional Expression manager application to create and maintain a library of conditions. These conditions can contain expressions and class files. In other applications, such as Application Designer and Security Groups, you select from predefined conditions to set up conditional behavior.
When the express evaluates to true, condition let you configure access to fields, tabs, and other user interface controls within applications. For example, you can set the following types of conditional access:
- Give read-only access to information displayed in a field
- Give read-write access to information displayed in a field
- Give a user group read-only access to a specific field or action in an application
- Give all members of a user group read-write access to a specific application
- Do not display a field or tab in an application to certain users
You can also set access to application options, controls, or data elelments. Examples include:
- Grant access to application options in the Select Action menu for a security group
- Configure any property in a control for a group, such as making a control hidden, masked, read-only, or required
- Configure other properties, such as color, label, and application link, to differ according to group and different conditions
- Show or hide data attribute globally or for a security group
Now I will show you how to set this up.
First, you need to create a condition. To do this, go to Administration-> Conditional Expression Manager. Click on new row to add a record and give it any name you want, since our condition will check if the GL Account is null we will just call it “Check if GL Account is empty”. Enter the following values:
- Type – EXPRESSION
- Expression – STATUS <> ‘WAPPR’ AND :GLACCOUNT IS NULL
Yes the semicolon (;) is required in the expression field. So this condition is checking if the GL Account value is null and the status is WAPPR. If this condition is met, the result will return true.
Now the next thing we need to do, is associate this condition with an attribute. So go to Application -> Security Groups. Once there, go to Select Action -> Global Data Restrictions. In the dialog, click on the “Attribute Restrictions” tab. Click on new row and enter the following values:
- Object – WORKORDER
- Attribute – GLACCOUNT
- Application – WOTRACK
- Type – REQUIRED
- Reevaluate – Checked
- Condition – 1001 (whatever the ID of the condition you created above)
Now click OK to save. Now if you go into the WOTRACK application, you will be able to create a workorder without a GL Account and save it. But once you try to change the status to anything other than WAPPR, you will get an error message saying that the GL Account value is required.
You can also look at this KB article for more info on setting up required field using attribute restrictions…
Update: Read the comments below on the possible scenarios of what can happen when making fields required using the conditional expression manager…