Maximo

 View Only
  • 1.  Setting field defaults (three different techniques)

    Posted Fri August 13, 2021 12:51 AM
    Edited by User1971 Mon August 16, 2021 08:44 PM
    I came across a TechNote that highlights three different ways for setting default field values:

    Setting Field Defaults:
    https://www.ibm.com/support/pages/setting-field-defaults


    I thought I'd share for anyone who might not have been aware of the second or third technique - like me.


    There are three ways to set a field default in Maximo.


    1. Database Configuration

    The first way is to set a field default at the database level using Database Configuration.

    To set a field default in Database Configuration:

    • Select the object the attribute exists in.
    • Select the attribute for which the default is to be set.
    • Expand the details of the attribute.
    • In the right hand side of the Details section there is a Default field.
    • This is where you would enter your literal value for the default value.


    There are also three system defaults that work in the Database Configuration Default field. They are:

    • &SYSDATE& - This will default a field with the current system date/time
    • &USERNAME& - This will default a field to the current USERID value
    • &AUTOKEY& - This is used for attributes that are set to autonumber to default to the next autonumber value.
    • &PERSONID& - This will default the current user's PERSONID value.

    Note: The four system defaults will only work in Database Configuration.



    2. Default Object in Application Designer

    The second way to set a field default in Maximo is by using a Default Object in Application Designer.

    To set a default at an application level using Application Designer:

    • Launch Application Designer.
    • Select the application in which you want to set a default.
    • From the Select Action menu, select the Toggle/Show All Controls option.
    • Select the Tab of the application the field exists on.
    • Select the Control Palette icon and drag and drop a Default Object object to the section the field you want to set the default on exists in.
    • You will then see an object defaultvalue… just below the section header for that section.
    • Highlight the defaultvalue and select the Control Properties icon.
    • Enter the attribute for the field you want to set the default value for, this value can be found by looking at the properties for the field.
    • Also enter the default value for the field.


    Once these values are entered in the properties for the default object, the attribute and default will display for the default object in the section. If additional defaults for other fields are desired, drag and drop a new default object for each field and repeat the steps for filling out the properties.

    Note: The system defaults of &USERNAME&, &SYSDATE&, and &AUTOKEY& will not work using the second method.

    To default a field with the value of another field:

    In the Object Default properties, leave the Value field enpty and enter a value in the From Data Source ID field for example MAINRECORD and in the From Attribute field enter the attribute value of the field you want to take the value from.



    3. APPFIELDDEFAULTS table

    The third method requires the use of a SQL tool.

    There is an appfielddefaults table in Maximo which allows you to set a default by application, group and/or user. The object and default values are required, but you can then specify a certain app that uses that object or security group or user you want to have a particular default value. 

    Once your record(s) are inserted in the appfielddefaults table, you will need to restart the Maximo application server for your changes to take effect.

    .



  • 2.  RE: Setting field defaults (three different techniques)

    Posted Fri August 13, 2021 12:54 AM
    Edited by User1971 Mon August 16, 2021 08:44 PM


  • 3.  RE: Setting field defaults (three different techniques)

    IBM Champion
    Posted Mon August 16, 2021 01:44 AM
    I would also like to add this also:
    - Using automation scripts
    - Using formulas ( for calculated fields)
    - Using Java extension
    - Using database triggers

    These days, we don't do many Java extensions and don't recommend database triggers.  The difference is that all the others can be done from the Maximo UI and thus are easier to maintain.

    That said, recently, I had a client who had a custom field designed by another BP that had an issue with the value not populating whereas in the past it was.  I could not see any which way that it was to be populated until I remembered about the formulas.

    Ahhh, flexible Maximo.

    ------------------------------
    ===============================
    Craig Kokay,
    Lead Senior Maximo/IoT Consultant
    ISW
    Sydney, NSW, Australia
    Ph: 0411-682-040
    =================================
    #IBMChampion2021
    ------------------------------



  • 4.  RE: Setting field defaults (three different techniques)

    Posted Mon August 16, 2021 08:28 AM
    I did a webinar (https://www.youtube.com/watch?v=2PB5PKdc628) on some of the default value options last year. I tried to explain when you should use which of the options, but in summary, the best event to typically use on a true default value is OBJECTNAME.NEW script launch point. You define a script with no launch point and the name WORKORDER.NEW for example and your script fires immediately and you can perform any type of logic that you want. 

    Craig has some that I didn't really talk about in my webinar (formulas, java extension, and database triggers). Formulas I didn't treat as a default value because it is going to update as well as things change. That's not a bad thing, just a different use case. Java extension could be used for default values (IE you could extend the .add() method on the object) but would be identical to the OBJECTNAME.NEW script and the pain of EAR rebuilds makes that a bad choice. Database triggers aren't supported by IBM which automatically eliminates it as an option for me. 

    It was a good example though in Maximo in how you sometimes have 10 ways to do something, without necessarily always having a "right way". Sometimes it really depends on what you're trying to accomplish.

    ------------------------------
    Steven Shull
    ------------------------------