Hi @smcvr
If you solve the mapping what user is in the selected department you can find a user and assign him to a workflow role and the role use in the task,
you need to find a team and a role from a object the workflow is related
Add the participant(user) to the role.
example from Change Task object

generally example API to add a participant to a role is >
wt.project.Role teamRole = wt.project.Role.toRole(roleName); // roleName is a internal name of role what you want to update
wt.org.WTPrincipalReference princRef = null; // you need to find your user and get WTPrincipal object in my case I have a WTPrincipalReference and from this object I fet WTPrincipal - just for explanation PS: WTPrincipal is a root type of WTUser
wt.maturity.PromotionNotice targetObject = (wt.maturity.PromotionNotice)primaryBussinessObject; // from workflow primaryBussinessObject can be any Change Object Promotion, ChangeRequest, Activity, Notice
wt.team.Team team = (wt.team.Team) targetObject.getTeamId().getObject();
wt.team.TeamHelper.service.addRolePrincipalMap(teamRole, princRef.getPrincipal(), team);
Adding user to a role has to be done before a workflow task is run.
Hope this explanation can help
PetrH