We have a requirement to force certain Items to be direct issue on Planned Materials. This plant has these parts in Inventory but they are not actually stocked. There is a field on the Inventory record we added to mark it as "DIRECT ISSUE". They want us to automatically mark these parts as direct issue if someone tries to add such an Item on a Planned Material line and fill out the Storeroom field. Here is where our script gets stuck:
Step 1) User enters the part number in the Item Field. Storeroom is empty but required.

Step 2) User enters the storeroom, tabs off and our script fires on the WPMATERIAL.LOCATION attribute. When this happens, there is an error that gets stuck in the storeroom attribute.

Maximo wouldn't show us this error nor would it get logged. So I figured out that if instead of manually typing in the storeroom, if I use the select value and choose it via the UI. I can see the error that is getting stuck:

Here is our script firing on the WPMATERIAL.LOCATION attribute (Run Action Event). Basically, get the inventory record for that Item, check if it is marked direct issue (our custom attribute) and that the storeroom is set. If that is all true, mark the WPMATERIAL line as direct issue and blank out the location.
inventorySet = mbo.getMboSet('INVENTORYSTATUS')
if not inventorySet.isEmpty():
inventory = inventorySet.getMbo(0)
if inventory.getString("REORDERTYPE")=="DIRECT ISSUE" and not mbo.isNull('LOCATION'):
mbo.setValue("
directreq", 1)
mbo.setValueNull("location")
I think this error arises because we just manually typed a storeroom into the storeroom field but then our script fires and sets the planned material line to Direct Issue
(directreq). At this point, Maximo is attempting to blank out the storeroom and storelocsite via it's normal logic tied to directreq but at the same time we also just set the storeroom via the UI. There has to be some conflict between those two situations causing that error?
My thought process of setting the location (storeroom) to null in that second line was that maybe blanking out the storeroom prior to setting
directreq would help avoid this error but no luck. It also doesn't matter if I try setting the location to null before or after the directreq line.
When setting
directreq, I have tried all the MboConstant variations of No Access Check, No Validation, No Action. The only one that gets us relatively close is MboConstants.NOVALIDATION_AND_NOACTION or using Delay Validation. But then we either lose all the Maximo logic of blanking out the storeroom field, storeroom site, setting the fields to read only etc or Delay Validation will delay it but then if the user changes items, the whole screen is out of whack.
Maybe I shouldn't run any logic on the LOCATION attribute because it has all this internal logic tied to it?
Anyway, I have tried so many variations on this thing, any input would maybe help me break into a new way of thinking about and solving this. Thanks!
------------------------------
Daniel Gruszka
------------------------------
#AssetandFacilitiesManagement#Maximo#MaximoIntegrationandScripting