Maximo

Maximo

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

 View Only
  • 1.  Fire External API on WorkOrder Status change

    Posted Wed June 30, 2021 06:03 AM
    I need to fire a REST API Call from inside Maximo when a WorkOrder status is updated.

    something like https://myDomain/rest/status.php?_usr=Me&wonum=WONUM&status=STATUS&_action=PUT

    I dont need to listen for a response.

    Many thanks

    ------------------------------
    Tony McManus
    tony@visualiseinfo.com
    ------------------------------



    #Maximo
    #MaximoIntegrationandScripting
    #AssetandFacilitiesManagement


  • 2.  RE: Fire External API on WorkOrder Status change

    Posted Wed June 30, 2021 11:27 AM
    Edited by System Test Tue August 22, 2023 04:41 PM
    I interpreted this as an integration question. If it is not then don't read through the reply. There are ways you can call REST from the maximo GUI using simpler methods like Automation Scripts.

    I am wondering if you had the chance to look(Play) with the MIF. When I started out I start at the MXXML endpoint which delivered files when Objects of interest changed
    In a Nutshell, you should be interpreting the Menu of Integration like that ObjectStructure, So for e.g, you will need an OS for WO if it does not exist or suffice your needs.I use MXWO so I know it will generate a change event. Second, you need a Publish Channel in that you will point to the first step and enable the listener. While on that screen you want to think like is the data to my real external system consumable the way Maximo spits out. If you need the XML modified this screen gives you those abilities(XSL or UserExit or AS).
    Having done that now you need an External system and a Handler. The Handler is what is responsible for your REST call. Here in frustrations starts as it can only be done trial and error as many real REST systems require your JSON to go with the right things but IBM has given you a testing interface.I would use HTTP and try if there is already an existing integration and make sure you run debug on integration so you can see the out messages. Now you need to attach your PublishChannel and the endpoint and make the External system active. The external system relies on the JMSSEQConsumer cron task so you need that to run in a good fashion(30 S while you test or so on). So with all that do make a change to the WO and look to see if outbound communication occurred.If not look in message reprocessing until you have all hiccups cleared.
    similar to your task https://moremaximo.com/communities/community-home/digestviewer/viewthread?MessageKey=94cd093d-f466-4e33-b945-87c31de44300&CommunityKey=784e8753-d7af-4281-8463-e86f3b5d7076&tab=digestviewer#bm94cd093d-f466-4e33-b945-87c31de44300  if you put a class file or AS to trap the return you can do what you want or leave it empty as you said you don't need to wait for it to work successfully or not.
    Hope that helps


    ------------------------------
    Appu Nair
    ------------------------------



  • 3.  RE: Fire External API on WorkOrder Status change

    Posted Mon January 08, 2024 10:41 PM

    In addition to Appu's answer, I'd recommend using the JSON Mapping if you have it on your Maximo version instead of the XSL/UserExit transformation. You need a sample JSON your external system accepts, but it's easier to do and manipulate the output.



    ------------------------------
    Maycon Belfort
    Consultant
    BPD Zenith
    Melbourne
    Australia
    ------------------------------



  • 4.  RE: Fire External API on WorkOrder Status change

    Posted Thu March 21, 2024 05:07 PM

    Did you allready find the solution?

    I am looking for the same.
    Just a simple piece of code in the AppCustomizations.js 



    ------------------------------
    Vincent Wanders
    ------------------------------



  • 5.  RE: Fire External API on WorkOrder Status change

    Posted 15 days ago

    Triggering an external API on WorkOrder status change ensures real-time updates across systems. When a status changes, an automated call sends relevant data to the external endpoint. This improves workflow synchronization, reduces manual intervention, and supports seamless integration between internal operations and third-party services or platforms, enhancing overall efficiency. Visit us:  mcdo breakfast



    ------------------------------
    carla hall
    ------------------------------



  • 6.  RE: Fire External API on WorkOrder Status change

    Posted 14 days ago

    Here is example of Automation Script in Python. The Code can be on Save of workorder or also called from Escalation or Cron task.

    from java.lang import Exception
    from java.lang import String
    from java.util import HashMap
    from psdi.iface.router import HTTPHandler
    from psdi.mbo import Mbo
    from psdi.server import MXServer
    
    null       = None
    
    userInfo   = MXServer.getMXServer().getSystemUserInfo()
    userid      = userInfo.getUserName()
    wonum    = mbo.getString("WONUM")
    status       = mbo.getString("STATUS")
    
    #
    # build URL
    #
    
    #
    # baseurl can be also read from System Properties if needed.
    # baseurl = MXServer.getMXServer().getConfig().getProperty("some.system.propertyname.youwillcreate")
    #
    
    baseurl = 'https://myDomain/rest/status.php?_usr='
    
    url = str(baseurl) + str(userid) + "&wonum=" + str(wonum) + "&status=" + str(status) + "&_action=PUT"
      
    #
    # Build HashMap to invoke Web Service. map wil contain request parameters.
    # errorResponse will contain parameters to handle error response.
    #
      
    map = HashMap()
    errorResponse = HashMap()
    handler = HTTPHandler()
    
    map.put("URL",url)
    map.put("HTTPMETHOD","GET")
    map.put("ERRORONSTATUS",False)
    map.put("RESPONSE_HEADERS",errorResponse)
    
    try:
        responseBytes = handler.invoke(map,None)
    except Exception as vError:
        service.log_error("*** Error invoking Service ************")
        service.log_error(str(vError))
        service.log_error("*** **** **********************************")
    #
    # Check if response code is 200. Then add more logic if needed
    #
    
    if errorResponse.get("RESPONSE_STATUS") is not None and int(errorResponse.get("RESPONSE_STATUS"))==200:
       response = String(responseBytes,"utf-8")
       response = eval(response)



    ------------------------------
    Prajesh (PJ)
    ------------------------------