Saturday 22 December 2018

Conditionally Attaching and Limiting any Domain through Automation Script | IBM Maximo

sometimes requirements are like we need to redefine a domain; lets say a table domain to any attribute, or we may want to change domain as the condition changes.

 suppose End user is only able to see item as per the storeroom dynamically and only the items with reorder is enabled while planning material in workorder application.



1. create a new Table domain
domain: WPITEM
validation: itemnum = :itemnum
2. Write an Attribute Launch Point
Object: WPMATERIAL
Attribute: ITEMNUM
Events: Retrieve List

we will write the WHERECLAUSE in our script as per the conditions.



Script(jython):
VLOC = mbo.getString("LOCATION")
domainid = 'WPMITEM'
if VLOC is None or VLOC == "":
    vlocnull = "status = 'ACTIVE'"
else:
    vlocnull = "itemnum in (select itemnum from inventory where location='"+ mbo.getString('LOCATION') +"' AND ITEMSETID = 'ITEMSET' AND SITEID = 'BEDFORD' AND REORDER='1' AND STATUS = 'ACTIVE')"
listWhere = vlocnull
#    listWhere = "itemnum in (select itemnum from inventory where location='"+ mbo.getString('LOCATION') +"' AND ITEMSETID = 'SET1' AND SITEID = 'BEDFORD' AND REORDER='1' AND STATUS = 'ACTIVE')"

we are done :)

1 comment: