Example 1 - Choose your assignee

Let's say you want to implement a workflow which should let the user select an agent they need help from based on the agents' location and other details like company department. Supposing that each employee has a user property with the country that they are based at; and that all employees are also grouped by their role in the team, this can be implemented very easily. After the end user selects the agent they want help from, an issue can be assigned to such employee.

To do this, add a Blitz Actions custom field and configure a button with the following steps:


In this case, all screens should be visible, and thus – all condition scripts should return "ENABLED".

The button can be a primary screen where you can select the country. The screen script for the first button lets you select the available countries. 

use "poweraction"; setActionTitle("Country"); string[] countries = {"USA", "Canada", "The Netherlands"}; createSelectList("Country", countries, "", false, true, "Select the country where you are based"); setExecuteButtonText("Next");

By declaring the package (line 1) the script can now use the shortened version of the routine names. So instead of using BA_setActionTitle("Country") we can simply write setActionTitle("Country").

 

In the action script of the button we need to get the value from the screen and save it into an auxiliary value:

use "poweraction"; string country = getSingleValue(argv, "Country"); setBlitzAttribute("country", country);

After a user selects a country, they should be selecting a further filtering parameter – department. In this case, the screen script should look like this:

use "poweraction"; setActionTitle("Department"); string[] departments = {"HR", "Sales", "IT"}; createSelectList("Department", departments , "" ,false, true, "Select the department that best applies for your request"); setExecuteButtonText("Next");

In the action script of the first step, we need to get the value from the screen and save it into an auxiliary value:

The last screen provides a list of users that are in the selected country and work in the selected department.
Thus, the select script will consider the values set in the previous screens.

In the action script, we only set the selected value as the assignee:



For this example, after you click the main button, you'll get a succession of the following screens:

After the last screen executes, the assignee of the current issue will be set to the value selected in the User field - "josh" in this case.