Maximo Open Forum

 View Only
  • 1.  Automation Script to set everything of a record READONLY, but only leave specific fields or functions editable

    Posted 12-21-2022 10:53
    Hi All,

    We are using Maximo 7.6.1. For all of our GIS synchronized "Locations" in Maximo, we currently have an automation script to restrict everything of this object to be READONLY. Now we encounter difficulties to exclude some specific fields and functions to be editable, such as "Description" and "Attachments".

    Our current script is using "setFlag" method to restrict the whole object:
    ------------------------------------

    if mboName == 'LOCATIONS':
        mbo.setFlag(MboConstants.READONLY, True)
    ------------------------------------

    So everything of the Location object is set as READONLY:


    We then tried to use the "setFieldFlag" method to exclude field "DESCRIPTION":
    ------------------------------------
    if mboName == 'LOCATIONS':
        #mbo.setFlag(MboConstants.READONLY,True)
        mbo.setFieldFlag(["DESCRIPTION"], False, MboConstants.READONLY, True)
    ------------------------------------

    However, it leaves all other exclusive tabs and fields editable (grey line indicates READONLY; black line indicates EDITABLE):


    Is there a way we can still set everything of the object as "READONLY", but only leaves one specific field or function editable? We do want to have "Attachments" editable in real request.

    Thanks very much,

    Frank Meng

    #WorkManagement

    ------------------------------
    Frank Meng
    City of Oshawa
    ------------------------------


  • 2.  RE: Automation Script to set everything of a record READONLY, but only leave specific fields or functions editable

    Posted 12-22-2022 10:01
    Frank, is the intent to prevent front end users from editing locations and related records for locations that are sync-ed with GIS?  If so, it might be easier to tackle this as an application configuration using a condition that evaluates whether the location is GIS-synced. This condition could then be used with a sig option associated with each tab or section you want to make read only, and you could also use it with conditions on the existing sig options that control the actions available in the locations application.  For example, if you populate GISPARAM1 on your synced records, you could use a condition of "GISPARAM1 is null" on all of the Locations application sig options you want to restrict to non-GIS locations, and you could add a "NOTGIS" sig option to the application and configure it to use this same condition to set the readonly property to true if the condition is false.  This way, you could make the entire Specifications tab read only for GIS-synced locations, but you could leave the Safety or Meters tabs editable if you wanted.  You could add a new section on top of the main section of the Location tab and move the Attachments into this new top section while putting the NOTGIS sig option on the main section that contains everything else.  This would prevent editing of all the fields but still allow attachments to be added.

    ------------------------------
    Nancy Lerner
    Brio Consulting
    ------------------------------



  • 3.  RE: Automation Script to set everything of a record READONLY, but only leave specific fields or functions editable

    Posted 12-23-2022 16:43
    Thanks very much Nancy! 

    We did try to use SigOptions with conditional expression and result to test around. It makes great progress.

    But some related object records such as "Specifications" will not apply the conditional expression where clause well.
    I found user can still DELTE existing "Specification" record of a Location. Even though I tried to add another SigOption to hide the "delete" trash can icon from the UI and add relationship in the conditional expression's where clause, the trash can icon still shows up, because ":plussisgis =1 or :locations.plussisgis=1" will always be considered false in this situation.

    I know most of the time, the mbo is "locations". For above situation, it looks it's not considering the condition for object as either "locations" or "locationspecs", and won't hide the icon to block user to delete specifications record of a GIS synched location.

    Hopefully we will find a work around or do you have a better solution for that. It's really appreciated.

    Thanks very much and Happy Holidays!!!

    ------------------------------
    Frank Meng
    City of Oshawa
    ------------------------------



  • 4.  RE: Automation Script to set everything of a record READONLY, but only leave specific fields or functions editable
    Best Answer

    Posted 12-23-2022 20:11
    Frank, for the sig option you created for the trash bins, what property were you setting?  It seems like you should be able to set the display property to false if the condition :locations.plussisgis = 1 is true (and set display to true if the condition is false).  If that does not work, you might consider a sig option with a condition that just checks whether the user is in the MAXADMIN group and set the display property to true or false accordingly. That would prevent users from deleting location specifications regardless of whether the location was in GIS, which seems reasonable unless there is a business need for users to do this often enough that they need to be able to do it without admin assistance.

    ------------------------------
    Nancy Lerner
    Brio Consulting
    ------------------------------