I have an interesting scenario for team filters that I cannot figure out. Here is my script as an example:
var checkRole; var assignedTo; checkRole=$util.getValue('Role'); if(checkRole=='Available') { assignedTo=team.findMembersByRole(checkRole); } //In case no team members Available, assign to whole team if (Object.keys(assignedTo).length == 0) $result=team.getAllMembers(); else $result=assignedTo;
In this scenario, if there are no users assigned to the "Available" role, then I have a catch all that assigns to the whole team. However, I have Round Robin distribution enabled as well.
The end result is that it randomly round robin distributes the task within the whole team, even if the user is not in the role I'm searching for.
My desired result is to rather assign to the whole team without round robin, so that it goes to Unassigned Tasks instead. My challenge is that under normal circumstances when the "Available" role is found, it needs to still Round Robin distribute.
Is there a way to achieve this via the Javascript filter or some other method?
To further explain above, I'm looking to have a "task queue" and then auto assign a single task to a user once they become free (i.e. don't have a task assigned to them currently). Kind of like a call centre, where an operator can only handle one phone call at a time and pending phone calls wait in a queue. The queue is obviously "Unassigned Tasks" in Forms, but once it's there, tasks need to be manually assigned to users and this is not what I want. It needs to be automated and round robin to the next available user.