Let's say you want to implement a workflow which should let the user choose whose he wants, 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 a user property with the country that he or she is from 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 end user selects the user agent they wants want help from, an issue can be assigned to this usersuch employee.
To do this, add a Blitz Actions custom field and configure a button with the following steps:
In this case, all the screens should be visible, so all the and thus – all condition scripts should return "ENABLED".
The button is the can be a primary screen from where you can select the country. The screen script for the first button enables lets you to 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 needare helpbased"); 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:
...
After a user selects a country, they should be selecting a further filtering parameter – the office.The same things should be done for the first step as well. In department. In this case, the screen script should look like this:
Code Block |
---|
BA_setActionTitle("OfficeDepartment"); string[] officesdepartments = {"HR", "Sales", "IT"}; BA_createSelectList("OfficeDepartment", officesdepartments , "" ,false, true, "Select the department that officebest whereapplies youfor needyour helprequest"); 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. That's why
Thus, the select script should will consider the values values set in the previous screens:.
Code Block |
---|
BA_setActionTitle("User"); string country = BA_getBlitzAttribute("country"); string office = BA_getBlitzAttribute("officedepartment"); string[] users; string[] usersInOfficeusersInDepartment = usersInGroups(officedepartment); for (string user in usersInOfficeusersInDepartment) { if (getUserProperty(user, "country") == country) { users = addElement(users, user); } } BA_createSelectList("User", users, "", false, true, "Select the person you want 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; |
...
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 from in the User field - "josh" in this case.
...