Make a field required using the Conditional Expression Manager

interprosoft.com

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.

Please login or upgrade your account today

  • spivot

    This solution is very tricky. It usually works well when you defaulted this field with some values on all records for the condition. Otherwise you will get error messages (in your case “GL Account is required”) on any WO’s modification in APPR/INPRG/COMP… statuses. You can run into this error message not only in WOTRACK application but in Receiving or Invoices because they update Service/Material costs field…
    Then:
    - parent/child relation – when you change status on Parent and receive an error about missing field (that wasn’t actually populated on child’s record) and you don’t know what to do, because you have clearly set this field on Parent
    - WO tasks have status field too – this issue can be fixed by adding ” and istask=0″ condition to “Check if GL Account is empty” condition.

    As I said it is tricky ;-)
    Regards,
    Alexey

    • http://interprosoft.com Chon

      Thanks, that is a very good point that you made. As with any Maximo modifications, it bears warning to make sure you fully test all modules before using it in a production environment. I did not test this fully so the changes you suggest should work.

      Now that we are thinking along these lines, I wonder if I generated a PM into a work order with a default status of INPRG and without a GL Account, if it would throw an error?

      • spivot

        Yes, it will.

        I’ve tested this scenario with my field and Generate WO function on a PM with empty field through an exception:
        BMXAA3210E – Failure while generating work orders.
        BMXAA4195E – Required field Risk Level is blank.

  • bpscotty

    Looks Tricky!

    I have a challenge where the customer wants the Serial Number field on Asset Application to be required and to immediately highlight that there is already an asset with this serial number.
    Setting the serial number to required is easy but how do I do the serial number warning?
    On the spreadsheet they currently use they make the field fill colour go red and have another column which states either Duplicate or OK using the formula IF(COUNTIF$1$2:$1$4201,< )>1,”Duplicate”,”OK”)
    Could you suggest a solution or a hint to the conditional expression, please
    Brian S

    • http://interprosoft.com Chon

      That’s a bit more complicated than making a field required. You may be able to do that with custom actions with some custom java code, but I am not sure.

      • bpscotty

        Yes! So, I decided to try and create a new field on the Asset application which states DUPLICATE if the serial number entered is a duplicate and OK if it is not.

        So far I have created an ALN Domain SNDUP which contains the values DUPLICATE and OK
        I have created an attribute in the ASSET Table called DUPSN which is non-persistent and references the SNDUP domain with a lookup of VALUELIST.
        I have added this field to the ASSET Application and on opening the application on any record I can click on the spyglass icon next to it and see the DOMAIN choices.

        I have a conditional expression used to run a query on the list part of ASSET which then lists all records that have a duplicate serial number

        exists(select 1 from asset where serialnum is not null and serialnum=:serialnum and siteid=:siteid and assetnum:assetnum)

        So, somehow I need to get Duplicate Serial # populated depending on the value in serial number and whether it is duplicated elsewhere in assets

        would you be able to help with this Chon?

        • http://interprosoft.com Chon

          You might have to use a custom action (System Configuration -> Platform Configuration -> Actions) to set that value to whatever you want.

          • bpscotty

            Okay will look into this – do you know of a good reference guide for action and workflow designing?

          • http://interprosoft.com Chon
  • Isukapallis

    Hi Chon

    How to display help files – how to create SR four steps ( for external SR Users) on start center.

  • Tim

    In your explanation of creating a conditional expression you say “Yes the semicolon (;) is required in the expression field.” Did you mean colon instead of semicolon?

    • http://interprosoft.com Chon

      Yes. Sorry!