Maximo

Maximo

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

 View Only
Expand all | Collapse all

Integration - Problem with User Exit Autoscript adding a Labor record

  • 1.  Integration - Problem with User Exit Autoscript adding a Labor record

    Posted Thu June 10, 2021 10:26 AM
    In our system, time is reported in an external application and sent back to Maximo via interface table. If time is reported for a Labor Code that doesn't exist, there is a user exit autoscript that creates the Labor record on the fly.

    This works fine with one organization, but we are in the process of adding a second organization. Maximo is trying to add all Labor records to the old organization even when the incoming transactions specify the new ORGID.

    The code in the autoscript is:

    irData.breakData()
    struc_object = irData.getCurrentObject()
    orgID = struc_object.getCurrentDataAsString("ORGID")
    laborSet = MXServer.getMXServer().getMboSet("LABOR", MXServer.getMXServer().getUserInfo("MXINTADM"))
    laborSet.setWhere("laborcode = '" + laborCode + "' and orgID = '" + orgID + "'")
    laborCodeCount = laborSet.count()
    if (laborCodeCount == 0):
        integrationLogger.debug("Labor Code does not exist")
        integrationLogger.debug("Creating Labor Record " + laborCode + " in Organization " + orgID + ".")
        integrationLogger.debug("ORGID is " + orgID)
        labor = laborSet.add()
        labor.setValue("LABORCODE", laborCode)
        labor.setValue("ORGID", orgID,MboConstants.NOACCESSCHECK)
        laborSet.save()
        integrationLogger.debug("Labor Code Created")

    Can someone give me advice on how to ensure that the Labor record is added to the correct organization?

    TIA

    Shannon


    ------------------------------
    Shannon Rotz
    InComm Solutions
    New Westminster BC
    ------------------------------

    #Maximo
    #AssetandFacilitiesManagement


  • 2.  RE: Integration - Problem with User Exit Autoscript adding a Labor record

    Posted Thu June 10, 2021 01:42 PM
    Update:  solution posted on another group.  It is:

    Use laborSet.setInsertOrg(orgID) before .add()


    ------------------------------
    Shannon Rotz
    InComm Solutions
    New Westminster BC
    ------------------------------