Maximo Open Forum

 View Only
  • 1.  Data is not sending out from Maximo

    Posted 02-14-2023 05:50

    Hello Everyone,
    We created an automation script to call publish channel to send data out from Maximo.

    Below code is used in automation script - Object Launch point - Add, Update - After Save

    try:
        PublishChannelCache.getInstance().getPublishChannel("<publish channel name>").publish(mbo, True);
        server = MXServer.getMXServer()
        userinfo=server.getSystemUserInfo()
    except MXException:
        print("Error in the script")

    Data is sending out and messages are received in Message tracking, when we update on records from UI Application. 
    But when we update any field value from the backend (DB), data is not sending out and i am not able to see the message received in Message tracking.

    Can anyone tell why messages are not receiving when we update from the DB? 

    Thanks in Advance


    #Assets
    #Customizations
    #Integrations

    ------------------------------
    Ishwarya Soundarya
    Accenture
    ------------------------------


  • 2.  RE: Data is not sending out from Maximo

    Posted 02-14-2023 07:10

    When you are updating data directly in DB, is the Maximo framework being called which will call your automation script on Object Launch point - Add, Update - After Save? The answer is No as the script will run from the Maximo event which you have added here. 



    ------------------------------
    Prashant Sharma
    Sedin Technologies
    Connect with me @ https://www.linkedin.com/in/psharmamaximo/

    #IBM Champion 2022
    #IBM Champion 2023
    ------------------------------



  • 3.  RE: Data is not sending out from Maximo

    Posted 02-14-2023 08:14

    Prashant is correct. I'll expand a bit to hopefully provide some clarity. 

    Publish channels, automation scripts, etc. depend on event listeners that get registered when the application starts up (or when they get added if you add it while the application is running). These are java classes that are running in the application. We do not support nor does Maximo utilize database triggers for example (with the minor exception of updating rowstamp on Oracle). Maximo will occasionally need to rebuild tables which could cause the trigger to get lost and the database trigger could cause issues with our application. 

    Updating the database directly should only be done when a bug is found that cannot be fixed any other way. Most likely, if support hasn't given it to you to run you shouldn't run it. None of the application logic will evaluate in a database update. For example, if you update the status on a record there are rules around when that can be done. You can't cancel a WO if there are actuals, you can't cancel a PO if it has receipts, etc. You're also likely to miss some of the additional logic that gets evaluated. Most of our statusable objects have a child object that records the status history, some of the objects have status changes rolling down to children records, some of our objects (like WORKORDER) insert into child tables conditionally like ASSETHISTORY when the WO is COMP/CLOSE based on organizational settings. These examples were all for status attributes but this applies to any object and any field. 

    Less importantly, I'm a bit confused by why you're invoking the publish channel here. A publish channel event listener will be on after save and you can setup rules to conditionally skip or modify as needed. 



    ------------------------------
    Steven Shull
    IBM
    ------------------------------



  • 4.  RE: Data is not sending out from Maximo

    Posted 02-14-2023 10:18

    Thank you Prashant and Steven.
    There is one read-only field (cost), so whenever we try to update the field from DB, data is not sending out (not seen in Message Tracking).


    The Publish channel script is on Asset object - Add, Update - After Save. There is another script on PM object (Add, Update - After save), but at the end of the script we are updating Asset values. So, whenever i add a Asset record, Asset data is sending twice in Message Tracking. 
    Because of this I have disabled the Event listener in Publish channel .


    The script was working good when we add or update the records from UI. Now its not working as expected when updating the read-only field from DB (Messages are not sending out).

    Any solution? Can you please help on this



    ------------------------------
    Ishwarya Soundarya
    Accenture
    ------------------------------



  • 5.  RE: Data is not sending out from Maximo

    Posted 02-15-2023 11:12

    It may not be working as you want it to, but it is working as designed. I can't think of any product that would continuously query the database looking for changes to records that were done outside of the product. 

    If information is read-only, that's a business logic rule that the product has for a reason. You need to understand the reason and then utilize the mbo.setValue("ATTRIBUTENAME",value,mbo.NOACCESSCHECK) when you know this update is safe. This would ignore the fact that it is read-only and trigger normal Maximo logic. 

    You mentioned cost on asset without specifying exactly which field but the ones we expect the user to provide (purchase price, replacement cost, etc.) are editable by default. The ones that are done via a process such as the year to date cost (YTDCOST) are read-only because they need to be done through their process. YTDCOST & TOTALCOST are dependent on the transactions that we have in Maximo. Each of the transaction tables (MATUSETRANS, LABTRANS, etc.) have a rollup flag on the transaction. If you update the YTDCOST without setting the rollup flag on those transaction tables and then someone rolls up the cost, your cost information is now going to be incorrect. We also do things that you may not be handling like rolling the transaction cost up the hierarchy. 



    ------------------------------
    Steven Shull
    IBM
    ------------------------------