i got this handled with the help of IBM Support (and feel like being kidded, but who cares).
Just for the case someone else has the same problem, you are not allowed to write the attribute as UPPERCASE but need to use lowercase.
Original Message:
Sent: Wed October 02, 2024 03:09 AM
From: Andreas Brieke
Subject: Enterprise Service - After User Exit Script not modifying data
Hi Rakesh,
thats all things i already checked. But in detail:
1) It exists, i'm 100% sure
2) Your script looks exactly like mine, there's just a log statement and a few comments more. I am not allowed to copy the script 1:1 from the customers system, so my script here is a bit stripped down. In real i have a few more log-statements in it to see the script running (like outputting json, outputting irData etc.).
3) i logged irData.toString() after modifying and the output looks absolutely okay. Seems like i am modifying the data correctly
4) I am aware of that, but as far as i have seen all updates from MAS Core come in as SYNC. So currently and for my tests no need to look for insert/update
5) Correct, i am working on the inbound transaction, so erData should not be the output i need. But as said i tried even that, makes no difference
6) I don't see any errors in the logs. Indeed i even set maximo.integration to DEBUG to see what is it doing. Without having the correct log statements by hand atm, it seems like my modified irData is not forwarded to the ObjectStructure. OS checks if my field is in the incoming data, but doesn't see any data for it
7) If i understood this process correct, i am only modifying the incoming Data on the ES before it gets handed to the OS. I am not sure how context & permissions should affect this, but as all other data coming in is correctly handed to the OS and is written to the system i would assume this is correct. Just my modifications are ignored.
8) OS looks okay and my field is in it.
To summarize, i already checked all these things. For me it seems like Manage is not taking irData from my script to pass it to the OS, it is taking the irData from before my modifications.
It feels like this is a bug, but i can't really imagine noone ever stumbled over this. This would mean all *USEREXIT.IN.AFTER script would not work.
------------------------------
Andreas Brieke
IT Service Management Consultant
SVA System Vertrieb Alexander GmbH
------------------------------
Original Message:
Sent: Wed October 02, 2024 02:42 AM
From: Rakesh Ghoshal
Subject: Enterprise Service - After User Exit Script not modifying data
t looks like you're on the right track, but there might be a few things to check and adjust to get the script working as expected in MAS (Maximo Application Suite) 9.0.1.
Here are a few suggestions to help troubleshoot and resolve the issue:
1. Confirm Field CXEMPLOYEENUMBER Exists
Ensure that the CXEMPLOYEENUMBER field is properly defined in the system, and it's available in the object structure you're working with. You can do this by checking the Database Configuration in Maximo or through the object structure definition in MAS.
2. Update the Script for Data Modification
It seems like you're using the irData object to manipulate the incoming data. Make sure that after modifying the JSON object, you're correctly setting the data back to the irData structure so that it can be persisted. Here's a more explicit way to ensure the changes are applied:
from com.ibm.tivoli.maximo.oslc import OslcUtils
from com.ibm.tivoli.maximo.oslc.provider import OslcJSONStructureData
# Convert irData bytes to JSON object
byteData = irData.getDataAsBytes()
peruserJo = OslcUtils.bytesToJSONObject(byteData)
# Add custom field value
peruserJo.put("CXEMPLOYEENUMBER", "1234")
# Update irData with the modified JSON object
irData = OslcJSONStructureData(peruserJo, osName, None, userInfo, messageType, True)
# Log the update for debugging purposes
service.log("CXEMPLOYEENUMBER set to 1234")
3. Verify irData Modification
Ensure you are passing the modified irData back into the process so the changes are reflected. Sometimes, scripts in Maximo require explicitly committing the changes for them to be saved.
4. Test Script on Object Insertion vs. Update
Make sure that the script is being called at the correct point in the transaction lifecycle. Depending on whether this is during an insert, update, or sync, the behavior might differ. For example, you might need to handle insert operations differently from update operations.
5. Use erData for Response Modifications
If your intention is to modify the response data that gets sent back, erData would be the appropriate object to use. However, since you're trying to manipulate data being inserted into Maximo from MAS, irData is likely the right object to work with.
6. Check Logs for Errors
If you are already using service.log() for debugging, check the logs in the Maximo Admin Console or SystemOut.log for any warnings, errors, or clues that might indicate why the field is not being set. You can also log the contents of peruserJo before and after modification to ensure the changes are being applied as expected.
service.log("Before modification: " + str(peruserJo))
peruserJo.put("CXEMPLOYEENUMBER", "1234")
service.log("After modification: " + str(peruserJo))
7. Ensure Proper Context and Permissions
Confirm that the script is running in a context where it has the necessary permissions to modify the fields and that the field you're trying to update is not being restricted by another process or validation.
8. Check Object Structure & Mapping
Verify the object structure configuration that you're working with to ensure that custom fields such as CXEMPLOYEENUMBER are correctly included in the mapping between MAS Core and Maximo Manage.
By following these suggestions, you should be able to pinpoint why the CXEMPLOYEENUMBER field is not being updated as expected. Let me know if you encounter any specific errors in the logs or need further clarification!
------------------------------
Rakesh Ghoshal
Principal Solution Architect
Gulf Business Machines
E-Mail: rghshal@gbmme.com
Linkedin: www.linkedin.com/in/rkg-kw
PO Box 4175, Safat, Kuwait
General Marketing & Services Representative for IBM WTC
www.gbmme.com