Conditional warning based on a keyword
In this tutorial we want to show you to a way to control the workflow of a group based on a keyword. This can be particularly useful if a job ha to be specially treated when a certain key term occurs.
In our example, this key term is "KLX908P":
The user who has taken over a corresponding job should receive the following message:
In the takeover-action of the corresponding group please insert the following script snippet:
if(task.description.toLowerCase().indexOf(keyword)>-1){
task.description=helper.insertOnTop(task.description, "<div style='border: 3px solid red;'>SPECIAL CASE - "+keyword+"!</div>");
}
You can find this text in the above mentioned script snippet in the block "<SPECIAL CASE -" and the defined keyword in the line "var keyword =" KLX908P ".toLowerCase ();" ; please adapt the displayed text and the keyword to your own needs.
However, the job can still be processed and finished "as normal". As a further security level in our example: if you press the "finish button" in the finishing dialog a separate information window should appear that shows a warning text. In our case "Really finish rask? Take note of KLX908P!". Of course, you can also adapt this to your own needs.
In the finish-action of the corresponding group the above mentioned functionality should be represented of the following script snippet:
if(task.description.indexOf(keyword)>-1){
if(1==helper.yesNoMessage("Really finish rask? Take note of KLX908P!")){
result="error";
}
}
The info window with the warning now looks like this: