Today we are going to show you the creation of user user input dialog box for the custom status field. We have a custom application which has the custom status field, it changes the status of work order tasks based on this custom status. The requirement came when there was no validation when the user changed the status. We will show you how created validation dialog box using automation script.
1. Go to Database Configuration and create a message for user input
Message Group: os_taskstatus
Message Key: os_taskstatus
Value: Do you really want to change the status?
Buttons: Yes, No
2. Create Automation Script:
Launch Point: Attribute
Events: Validate
Object: WOACTIVITY
Attribute: ZZOSACTIVITYSTATUS
Script: Jython
3. Script Body:
from psdi.server import MXServer
from psdi.mbo import MboConstants
vOsStatus = mbo.getString("ZZOSACTIVITYSTATUS")
def yes():
mbo.changeStatus(vOsStatus,MXServer.getMXServer().getDate(), "MY STATUS", MboConstants.NOACCESSCHECK)
def no():
mbo.setValueNull("ZZOSACTIVITYSTATUS")
def dflt():
service.log("dflt")
params = [str(vOsStatus)]
service.yncerror("os_taskstutus", "os_taskstatus", params)
cases = {service.YNC_NULL:dflt, service.YNC_YES:yes, service.YNC_NO:no}
if interactive:
if vOsStatus in ('INPRG','COMP','CAN'):
x = service.yncuserinput()
cases[x]()
1. Go to Database Configuration and create a message for user input
Message Group: os_taskstatus
Message Key: os_taskstatus
Value: Do you really want to change the status?
Buttons: Yes, No
2. Create Automation Script:
Launch Point: Attribute
Events: Validate
Object: WOACTIVITY
Attribute: ZZOSACTIVITYSTATUS
Script: Jython
3. Script Body:
from psdi.server import MXServer
from psdi.mbo import MboConstants
vOsStatus = mbo.getString("ZZOSACTIVITYSTATUS")
def yes():
mbo.changeStatus(vOsStatus,MXServer.getMXServer().getDate(), "MY STATUS", MboConstants.NOACCESSCHECK)
def no():
mbo.setValueNull("ZZOSACTIVITYSTATUS")
def dflt():
service.log("dflt")
params = [str(vOsStatus)]
service.yncerror("os_taskstutus", "os_taskstatus", params)
cases = {service.YNC_NULL:dflt, service.YNC_YES:yes, service.YNC_NO:no}
if interactive:
if vOsStatus in ('INPRG','COMP','CAN'):
x = service.yncuserinput()
cases[x]()
No comments:
Post a Comment