Maximo Open Forum

 View Only
  • 1.  Make audit enabled field null post save

    Posted 22 days ago
    Hi Team,
     
    I need some help to make audit enabled field blank/empty post saving the record and that blank/null value should not be set in audit field. 
     
    Before save :- audit enabled field will have value.
    After Save :- audit enabled field should be blank but field's null value should not be saved in audit field and should not make entry in audit table.
    Please let me know if any option avaiable to implement this.
    Thanks & Regards

    #Customizations
    #EverythingMaximo
    #HSE/OilandGas
    #MaximoApplicationSuite

    ------------------------------
    JustIn goodLuck
    ABS
    ------------------------------


  • 2.  RE: Make audit enabled field null post save

    Posted 16 days ago

    Hi Justin,

    Based on my knowledge of audit fields, this is not possible with out of box configuration of audit enabled fields. Audit fields track any changes made to the field. 

    You may be able to do a hacky automation script. Create an automation script that would clear the UI after the commit that would not commit to the DB. I am not sure if that would work or not if there is not a commit to clear the field. I am not an automation script expert, just throwing out an idea.

    Thank you,



    ------------------------------
    Allan Henle
    Naviam
    ------------------------------



  • 3.  RE: Make audit enabled field null post save

    Posted 16 days ago

    Justin,

    I do think an Automation Script is your best bet here. You could try writing a null (python None) to the field with a NOACTION modifier. Something like this:

    mbo.setValue('MYFIELDNAME', None, mbo.NOACTION)

    If that doesn't get you there you could always just run a SQL UPDATE statement from within the script. This is VERY much a workaround and bypasses Maximo logic, but it may be your best bet for this use case.



    ------------------------------
    Tim Ferrill
    Solutions Consultant
    Intelligent Technology Solutions
    tferrill@webuildits.com
    www.webuildits.com
    @tferrill/@webuildits
    ------------------------------



  • 4.  RE: Make audit enabled field null post save

    Posted 14 days ago

    Hi JustIn

    So, I stand confused.  You want to null out a field that is captured by the audit. That nodoes not make sense to me.  The whole purpose of auditing is to capture data that has been changed.

    Q: Do you want the field itself to be one of the triggers, but not record the value?  What has been suggested works.

    However, if you don't want the field to be a trigger and not record the value, then turn off that field in the Database Configuration application.  Simples.



    ------------------------------
    Craig Kokay
    Principal Consultant
    COSOL

    email: craig.kokay@cosol.global
    #IBMChampion
    ------------------------------



  • 5.  RE: Make audit enabled field null post save

    Posted 8 days ago

    Hi Justin,

    Yes this is possible with Automation - my script is just a quick test I did to see if it would work it's untested in the real world but it does function, that said it could with some work it could possibly be made to work on the existing Mbo/MboSet.

    I have a new attribute ASSET.CBTEST which is audit enabled and an Automation Script on the Object Asset which runs after save.

    The script looks like this

    from psdi.server import MXServer
    
    assetSet = MXServer.getMXServer().getMboSet("ASSET", mbo.getUserInfo())
    assetSet.setWhere(str(mbo.getUniqueIDName()) + " = " + str(mbo.getUniqueIDValue()))
    
    assetRecord = assetSet.moveFirst();
    
    if assetRecord != None:
        assetRecord.setValueNull("CBTEST")
        assetRecord.setEAuditFieldModified(False)
        assetRecord.getThisMboSet().save()

    I have re-fetched the Mbo using MXServer as a proof of concept here, in my limited testing it does refresh the screen correctly and doesn't throw any Record updated by another user errors but my system is just a Demo system with no interfaces or anything else that may add complexity to this functionality.

    When I null the value NOACTION (or any available MboConstants) didn't stop a second audit record being created when the values is nulled but this line assetRecord.setEAuditFieldModified(False) does suppress that second audit line.

    So if I update CBTEST to "Test Value" and hit save, I get an Audit Record with CBTEST set to "Test Value" and the value on screen and in the ASSET application cleared down.



    ------------------------------
    Chris Brown
    Naviam
    ------------------------------