When the escalation runs the action, the action starts the script. The script determines which group the service request is assigned to.
#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')
Variable | Binding | How binding is resolved |
---|---|---|
v_srclassif | CLASSSTRUCTURE.CLASSIFICATIONID | The scripting framework traverses the CLASSSTRUCTURE relationship from the SR object to the CLASSSSTRUCTURE object and retrieves the CLASSIFICATIONID value which is a string. |
srattrdiameter | TICKETSPECCLASS[ASSETATTRID='DIAMETER'].NUMVALUE | The scripting framework traverses the TICKETSPECCLASS relationship from the SR object to the TICKETSPECCLASS object and retrieves the value of the diameter attribute. To retrieve one attribute, the binding specifies a filter in square brackets [ASSETATTRID= 'DIAMETER']. |
v_srattrlen | TICKETSPECCLASS[ASSETATTRID='LENGTH'].NUMVALUE | The scripting framework retrieves a single value for the length attribute from the binding and filter. |
When the volume of the pipe is calculated, the script checks if the value is greater or less than 1000 cubic feet. Based on the result of the if and else condition in the script, the output variable v_servicegroup is set to service group A or service group B. The script retrieves the value from the v_servicegroup variable and enters the value into the service request.