Maximo

 View Only
  • 1.  How can we throw a system error message using script for integration

    Posted Tue May 23, 2023 09:32 AM

    Say we are creating a script for Object Structure Inbound processing and we are doing validations in beforeCreateMboset method, if we encounter a situation where in we want to throw an error message , how can we do that.
    I tried service.error but it doesnt seem to work. Is there any way we can throw error message and not skip the transaction.



    ------------------------------
    Akshay T
    ------------------------------

    #Maximo
    #MaximoIntegrationandScripting


  • 2.  RE: How can we throw a system error message using script for integration
    Best Answer

    Posted Wed May 24, 2023 08:02 AM

    Your declaration of your function will look something like:

    def beforeCreateMboSet(ctx):

    ctx is an extension of the ScriptService class. You can call any of the methods available via the service variable using the name of the parameter like ctx in this case. I could call ctx.error("emx","myErrorMessage") for example. 



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



  • 3.  RE: How can we throw a system error message using script for integration

    Posted Wed May 24, 2023 03:21 PM

    Thanks Steve for that insight



    ------------------------------
    Akshay T
    ------------------------------



  • 4.  RE: How can we throw a system error message using script for integration

    Posted Thu June 13, 2024 09:10 AM

    Hello Steve, 

    While using ctx.error in python It is not giving me error for duplicate records.

    I am creating workorder with same external reference id. Maximo is creating workorders , ideally it should display error message as duplicate record



    if woMboSet.getMbo(0) is not None:
                mxWombo = woMboSet.getMbo(0)
                mxWonum = mxWombo.getString("WONUM")
                params = ["Work Order being duplicate(MXWONUM:"+mxWonum+" SFWONUM:"+struc.getCurrentData("NG_SFWONUM")+")"]
                ctx.error("NG_WORKORDER", "NG_SKIP",params)

    Note: SFWONUM is external system Salesforce workorder Number



    ------------------------------
    Sonali Pandharpatte
    ------------------------------