Example: Creating the action launch point and script

You use a wizard to create an action launch point with service request as the object. You can paste script code directly into the wizard.

Procedure

  1. In the automation scripts application, select theCreate > Script with Action Launch Point action.
  2. Specify a launch point name and description.
    1. Specify the object as SR.
    2. Specify a name for the action. For consistency, use the same name that you used for the launch point.
  3. Enter a script name. For consistency, use the same name that you used for the launch point.
    1. Specify the script language as Jython.
    2. Enter the variable names and binding values in Table 1.
    3. For the v_servicegroup variable, select the Suppress Access Control check box.
    Table 1. Variables, types, and bindings specified in the action launch point
    Variable Name Type Binding
    v_srclassif IN CLASSSTRUCTURE.CLASSIFICATIONID
    v_srattrdiameter IN TICKETSPECCLASS[ASSETATTRID='DIAMETER']. NUMVALUE
    v_srattrlen IN TICKETSPECCLASS[ASSETATTRID='LENGTH'].NUMVALUE
    v_servicegroup OUT COMMODITYGROUP
  4. In step 3 of the wizard, enter the following script code:
    #Check if the SR is classified as a pipe leakage
    if v_srclassif=='PIPE_LEAK':
            #Now calculate total volume of the pipe-formula is:3.14 * length * (diameter / 24) ^ 2
            volume = 3.14 * v_srattrlen * (v_srattrdiameter / 24)**2
            if volume < 1000:
                    #If volume is less than 1000 cubic feet, just assign SR to GROUP A
                    v_servicegroup = 'GROUP A'
            else:
                    #If vol is greater than 1000 cubic ft, assign SR to GROUP B and create worklog
                    v_servicegroup = 'GROUP B'
                    # Now add the MBO API code to create a new record in the work log for the SR
                    worklogset = mbo.getMboSet ('WORKLOG')
                     worklog = worklogset.add()
                     worklog.setValue('clientviewable',1)
                     worklog.setValue('logtype','WORK')
                     worklog.setValue('description','System initiated processing-work assigned to GROUP B')
  5. To save the launch point, variables, and script code, click Create.


Feedback