Update: solution posted on another group. It is:
Use laborSet.setInsertOrg(orgID) before .add()------------------------------
Shannon Rotz
InComm Solutions
New Westminster BC
------------------------------
Original Message:
Sent: Wed June 09, 2021 05:17 PM
From: Shannon Rotz
Subject: Integration - Problem with User Exit Autoscript adding a Labor record
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