You are viewing limited content. For full access, please sign in.

Discussion

Discussion

Assign Task to Manager of Last User

posted on March 31, 2021 Show version history

Team management is really neat but doesn't quite satisfy a need I have. I have an approval task that I need to be able to assign to the manager of the last user repeatedly until very near the top of the organization chart. 

We had some ideas to work around this:

Use Forms hidden fields and lookup rules to get the manager of the current user and use that variable for task assignment.
This works but requires several clunky hidden variables and lookup rules. It also won't work with direct approvals since, without the form loading, the lookup rule doesn't trigger, so the variables don't update.

Use a workflow to retrieve the Manager of the last submitter and set that back to a Forms process variable for task assignment. (This is the one we are leaning toward)
There's still some hidden forms variables but fewer and no forms lookup rules (so this'll work with direct approvals). To do this though we'll need to build a unique workflow for each Forms Process to perform the Set Business Process Variable activities in workflow.

Doing weird stuff with team assignments
Here's a fun one I was personally disappointed didn't pan out: Use javascript in the Team Filters to go beyond what's built in. My boss set up a scheduled script to retrieve Active Directory user info and create a json file, to place on our forms server. This file mapped all the users to their managers. I wrote some javascript to pick up this file, use it to find the manager of the last submitter, and assign the task to them. (We'd have to create some kind of megateam for this to work with everyone in it). This didn't work though because picking up the json is asynchronous and the team Filter script wasn't okay with that. I hit a wall in not finding a way to get that json in there synchronously.

In a similar vein, I suggested giving everyone roles like "John Doe's Manager" and doing something like 

$result = team.findMembersByRole( team.findTaskLastSubmitters().pop().DisplayName + "'s Manager" )

But short of directly messing with the Forms database, we didn't see a viable way of maintaining that.

 

Thoughts? Ideas?

It'd be great if we had something easier to reuse. Or if a feature like this already existed in Laserfiche. If we could put more data on the Users, specifically who their managers are, it'd be really nice to just assign an approval task to "Last submitter's manager" instead of having to jump through all these hoops.

0 0
replied on April 1, 2021

This thread on making Active Directory available as a lookup table may also be relevant to you.

2 0
replied on March 31, 2021

Here's how I handled it.  I have an employee database, and included in that is their username and their supervisor's username.  Then I created a view on the database that joins the table to itself a half-dozen times, kind of like this:

SELECT
  emp.username AS emp_username,
  sup1.username AS sup1_username,
  sup2.username AS sup2_username,
  sup3.username AS sup3_username,
  sup4.username AS sup4_username,
  sup5.username AS sup5_username
FROM employee AS emp
LEFT JOIN employee AS sup1 ON sup1.username = emp.username
LEFT JOIN employee AS sup2 ON sup2.username = sup1.username
LEFT JOIN employee AS sup3 ON sup3.username = sup2.username
LEFT JOIN employee AS sup4 ON sup4.username = sup3.username
LEFT JOIN employee AS sup5 ON sup5.username = sup4.username

 

Then when the form is being initiated, I lookup this View from the initiator's username and populate several hidden fields.  As soon as the first submission is completed, I have the username of the initiator, plus 5 levels of the chain of command above them.  Assignments and approvals work fine because the lookup happened on an earlier task in the process.

1 0
You are not allowed to follow up in this post.

Sign in to reply to this post.