The web blog http://www.learnsccd.com strives to be a comprehensive guide to SCCD, TADDM, SERVICE NOW and MAXIMO tools. This is a personal site maintained solely by me. I intend to update it regularly.For live updates please follow us on.

User input by using choice messages in automation scripts.

User input by using choice messages in automation scripts.

The buttons that you can use on a choice message are OK, Close, Cancel, Yes, and No.

Configuring choice messages

launch point and automation script that implements a choice message, and its processing uses the Jython.

Steps:

1.In the Database Configuration application, select the Messages action and create a new message with the following values:
  Message Group:XXXXX
  Message Key  :yyyyy
  Display method:MSGBOX
  Message ID Prefix:BMXZZ
  Message ID Suffix:J
  Display id:1
  Value: Asset custodian can be notified through email when priority {0} is set. Send email?
  Button Selection: Check Yes or No Buttons
2.Go to Automation Scripts application, create a script with an attribute launch point to run the Attribute Launch Point.
3.Specify the launch point name, and select the ASSET object and the PRIORITY attribute.
4.In the Events section, choose the Run Action radio button.
5.Specify the script name and set the log level to DEBUG.
6.Paste the following source code and then click Create.
  # logic implementation if user selects Yes choice (clicks Yes button)
    def yes ():
     service.log("Sending Email")
  # logic implementation if user selects No choice (clicks No button)
    def no ():
    service.log("Not Sending Email")
  # logic to present the choice message initially
    def dflt ():
    params=[str(priority)]
    service.log("Throw ERROR")
  # Use the service utility's yncerror() method to push the choice message
    service.yncerror("XXXXX", "yyyyy",params);
    service.log (’$$SAM$ - entering yyyyy’)
  # Declare the user input choices and the corresponding functions implemented in this script
    cases = {service.YNC_NULL:dflt, service.YNC_YES:yes, service.YNC_NO:no}
  # Make sure the choice message is presented only
  #if the field validation was triggered from user interface
   if interactive:
    if priority < 2:
     service.log ("About to do something")
     # Use the service utility's yncuserinput() method to trigger the entire interaction
     # User's response is stored in a local variable x
     x = service.yncuserinput()
     service.log("User input: "+str(x))
     # Process the user input using Jython's case statement
     cases[x]()