My organization did something similar. I wasn't directly involved, so I might be missing something.Objective:Determine if a WO was edited in Anywhere -- to prevent anywhere users from changing the classification of a WO.1. Create a non-persistent field in WORKORDER called CGANYWHERE.2. Create an OSLC automation script to populate CGANYWHERE (indicating if an update came from Anywhere or not):
'''
Script: OSIN.OSLCWODETAIL
Description: This automation script will be used to set CGANYWHERE non-persistent field to indicate WO update came from Anywhere
Language: python
Details: This automation script will be used to set CGANYWHERE non-persistent field to indicate WO update came from Anywhere
Launch Points:
Integration User Exit Launch Point: OSIN.OSLCWODETAIL
from psdi.util.logging import MXLogger
from psdi.util.logging import MXLoggerFactory
'''
mxLogger = MXLoggerFactory.getLogger('maximo.script.cust.OSIN.OSLCWODETAIL')
if mxLogger.isInfoEnabled():
mxLogger.info('Inside automation script: OSIN.OSLCWODETAIL')
def beforeMboData(ctx):
mbo = ctx.getMbo();
if mbo and mbo.getName()=='WORKORDER':
mbo.setValue("CGANYWHERE",True);
3. Create a WORKORDER automation script that will throw an error if the classification changed and the update came from Anywhere:
'''
Script: VALIDATECLASSIFICATIONCHANGE
Description: Automation Script used to validate a CLASSIFICATION Change on Work Order
Language: jython
Details:
For Work Orders:
1. Don't allow the CLASSIFICATION to change if the [update came from Anywhere].
Launch Points:
1. WORKORDER.CLASSSTRUCTUREID - Validate
'''
from psdi.util.logging import MXLoggerFactory
mxLogger = MXLoggerFactory.getLogger('maximo.script.cust.VALIDATECLASSIFICATIONCHANGE')
if mbo.getName() == 'WORKORDER':
mxLogger.info('VALIDATECLASSIFICATIONCHANGE called for WORKORDER.')
# Don't allow the CLASSIFICATION to be changed from Anywhere
status = mbo.getTranslator().toInternalString('WOSTATUS', mbo.getString('STATUS'), mbo)
if status not in ('WAPPR') and mbo.getBoolean('CGANYWHERE'):
errorgroup ='cgwo'
errorkey = 'cannotChangeCLASSIFICATION'
mxLogger.info('VALIDATECLASSIFICATIONCHANGE done.')
#Maximo#AssetandFacilitiesManagement#MaximoAnywhere