For certain use cases it might be required to execute a script when a ticket has run through a workflow activity. You might want to use this, for example, to display another ticket in the Web Client after the workflow activity has been executed. From a user's (engineer's) point of view, the Web Client jumps to the next ticket. The latter can be a child ticket or the next ticket in a list, depending on the use case.
The system behavior is defined in an Admin Tool script, the PostActivityExecutionScript (sometimes also called Default Workflow Activity Script). The name of the script has to be set in the system property cmweb-server-adapter, postActivityExecutionScriptName, see System Properties.
This script is executed after every manual workflow activity. That means you have to insert all control mechanisms and intelligence into the script:
Starting with version 6.10.2, ConSol CM can open one of four different page types (in read mode) coming from the PostActivityExecutionScript:
The script just has to provide the respective object as return value. The following code shows an example for each of the four types.
switch(activity.name){
case 'defaultScope/Goto_ticket':
return ticketService.getByName("SUP-11")
case 'defaultScope/Goto_contact':
return unitService.getById(123)
case 'defaultScope/Goto_company':
return unitService.getById(456)
case 'defaultScope/Goto_resource':
return resourceService.getById(890)
}
Example: Jump to the next ticket in a list.
Figure 404: ConSol CM Admin Tool - Property for definition of postActivityExecutionScriptName
The PostActivityExecutionScript can also jump to a unit page (i.e., a company page or a contact page) or to a resource page simply by returning the unit or resource within the script.
Please see the following example script:
switch(activity.name){
case 'defaultScope/Goto_the_ticket':
return ticketService.getByName("SUP-11")
case 'defaultScope/Goto_the_contact':
return unitService.getById(123)
case 'defaultScope/Goto_the_company':
return unitService.getById(456)
case 'defaultScope/Goto_the_resource':
return resourceService.getById(890)
}
Code example 65: PostActivityExecutionScript
Another example, which also shows the Web Client behavior:
Figure 405: ConSol CM Admin Tool - PostActivityExecutionHandler script
switch(activity.name){
case 'defaultScope/Service_Desk/New_ticket/Open_Page_of_Main_Contact':
def main_cont = ticket.getMainContact()
return main_cont
// ( ... )
}
Code example 66: PostActivityExecutionHandler
Figure 406: ConSol CM Process Designer - Activity which will be controlled using the PostActivityExecutionScript
Figure 407: ConSol CM Web Client - Ticket with workflow activity which will jump to contact page
Figure 408: ConSol CM Web Client - Contact page which has been opened directly from ticket