Maximo

Maximo

Come for answers, stay for best practices. All we're missing is you.

 View Only
  • 1.  Field auto-populated vs manually entered

    Posted Thu September 09, 2021 12:19 AM
    Hi guys,


    I am on the SR application.

    Is there a way by which I can differentiate a
    LOCATION field value auto-populated by ASSETNUM (Assuming 1:1 relationship),
    and a LOCATION value that I manually entered.
    Both scenarios while being on the screen (isInteractive() = true).


    Basically, I want to use this differentiation in an automation script.

    ------------------------------
    KKunnuthara
    ------------------------------

    #Maximo
    #AssetandFacilitiesManagement


  • 2.  RE: Field auto-populated vs manually entered

    Posted Fri September 10, 2021 09:00 AM
    I'm not sure it's 100% reliable but what I've done is check that ASSETNUM is set and that the location on the asset (by getting ASSET.LOCATION) matches the location on the SR. In those cases I assume it's set by the asset. Any other change to the location field I assume is set by the user.

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



  • 3.  RE: Field auto-populated vs manually entered

    Posted Tue September 14, 2021 08:48 PM
    Thanks @Steven Shull @Steven Shull

    Following on from that, I have the following code to clear the assetnum, when its auto-populated by Location (when there is a 1:1 relationship​).
    This runs on 'Run Action' on attribute LOCATION of SR object.
    Its working OK in that scenario.

    However, its also getting triggered when an assetnum is manually entered on screen, and the location is auto-populated. 
    Is there a way we could prevent this second scenario?


    from psdi.mbo import MboConstants

    locationSet = mbo.getMboSet('LOCATION')
    location = locationSet.getMbo(0)
    if location is not None:
     locSysID = location.getString('SYSTEMID')
     if (locSysID == "TSN"):
       mbo.setValueNull("ASSETNUM",MboConstants.NOACCESSCHECK | MboConstants.NOVALIDATION_AND_NOACTION)​


    @Alex Walter @Jason Uppenborn   Any thoughts on this one?​​

    ------------------------------
    KKunnuthara
    ------------------------------



  • 4.  RE: Field auto-populated vs manually entered

    Posted Wed September 15, 2021 10:27 AM
    To get the initial value of the field before the user started playing with it *this time*, I would use srMbo.getMboValue("ASSETNUM").getInitialValue().asString().

    By *this time*, I mean since the user was allowed to enter data after the record was created new or loaded from the database. I haven't been that fine-grained before, but I expect getInitialValue() to return the value after default values have been supplied on a new record. You could prove this by checking whether getInitialValue() .asString() returns the same value for a field as getPreviousValue().asString() for the same field from some script based on something other than that field and before any other changes are made to that field.

    ------------------------------
    Blessings,
    Jason Uppenborn
    Sr. Technical Maximo Consultant
    Ontracks Consulting
    ------------------------------



  • 5.  RE: Field auto-populated vs manually entered

    Posted Wed September 15, 2021 11:25 PM
    Thanks @Jason Uppenborn

    Let me put the problem statement a bit more simpler.

    On the SR application, when LOCATION is entered and auto-populates ASSETNUM, I want to clear the ASSETNUM.
    In the scenario where the ASSETNUM is entered and auto-populates LOCATION, we want the default behaviour to continue, i.e both LOCATION and ASSETNUM to be there on the SR.



    ------------------------------
    KKunnuthara
    ------------------------------