Warning |
---|
Looking for the documentation on the newest versions of Power Actions for Jira 8? Click here and leave these dusty old pages behind! |
Let's say you want to implement an a workflow which should let the user to choose from whom he wants help, but to also consider their location and their capabilitiesselect an agent they need help from based on the agents' location and other details like company department. Supposing that each user employee has an a user property with the country he's from that they are based at; and that all of them employees are also grouped by their role in the team, this can be implemented very easily. After the client chooses the user he wants end user selects the agent they want help from, we can assign the issue to him.All you need to do is an issue can be assigned to such employee.
To do this, add a Blitz Actions custom field and configured with configure a single button and two 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.
Code Block |
---|
BA_setActionTitle("Country");
string[] countries = {"USA", " |
...
Canada", " |
...
The Netherlands"}; BA_createSelectList("Country", countries, "", false, true, "Select the country |
...
where |
...
you |
...
are |
...
based"); BA_setExecuteButtonText("Next"); |
In the action script of the button
...
we need to get the value from the screen and save it into an auxiliary value:
Code Block |
---|
string country = BA_getSingleValue(argv, "Country");
BA_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:
Code Block |
---|
BA_setActionTitle(" |
...
Department"); string[] |
...
departments = {"HR", "Sales", "IT"}; BA_createSelectList(" |
...
Department", |
...
departments , "" ,false, true, "Select the |
...
department that |
...
best |
...
applies |
...
for |
...
your |
...
request"); BA_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:
Code Block |
---|
string officedepartment = BA_getSingleValue(argv, "OfficeDepartment"); BA_setBlitzAttribute("officedepartment", officedepartment); |
...
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
...
.
Code Block |
---|
BA_setActionTitle("User");
string country = BA_getBlitzAttribute("country");
string office = BA_getBlitzAttribute(" |
...
department"); string[] users; string[] |
...
usersInDepartment = usersInGroups( |
...
department); for (string user in |
...
usersInDepartment) { if (getUserProperty(user, "country") == country) { users = addElement(users, user); } } BA_createSelectList("User", users, "", false, true, "Select the person |
...
|
...
to help you"); |
In the action script, we only set the selected value as the
...
assignee:
Code Block |
---|
string user = BA_getSingleValue(argv, "User");
assignee = user; |
If we go to the issue screen, to test the implementation, after pressing For this example, after you click the main button, weyou'll get a succession of the following screens as follows:
After executing the last screen executes, the assignee of the current issue will be set to the value selected from in the User field - "josh" in this case.