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
- In the automation scripts application, select theCreate > Script with Action Launch Point action.
- Specify a launch point name and description.
- Specify the object as SR.
- Specify a name for the action. For consistency, use the same name that you used for the launch point.
- Enter a script name. For consistency, use the same name that you used for the launch point.
- Specify the script language as Jython.
- Enter the variable names and binding values in Table 1.
- 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.CLASSIFICATIONIDv_srattrdiameter IN TICKETSPECCLASS[ASSETATTRID='DIAMETER']. NUMVALUEv_srattrlen IN TICKETSPECCLASS[ASSETATTRID='LENGTH'].NUMVALUEv_servicegroup OUT COMMODITYGROUP - 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') - To save the launch point, variables, and script code, click Create.