• vadim@workflowexcellence.com
  • Utah, United States

Nintex Workflow – Iterate through an Employee Manager Chain List

I have list of Employee/Manager pairs. If you see the screenshot of the list below, you can see that there are 4 employees, and you can see that there is a chain, going from :
Vadim Tabakman -> Fred Smith -> John Wayne -> Mary Roberts -> No Manager

The issue is, how do we create a Nintex Workflow that will go up the chain of managers, starting from the intiator.

Solution

We first start off of with getting the Initiators Display Name and storing it in a Text variable.

We can then use a Set a Variable action, to get the Manager of this employee, by performing a lookup on the Employees table. Both Employee and Manager are Person/Group fields. When performing a lookup via the Set a Variable action, I found that the the only way I could match a Person/Group field value, is by using the Display Name. Hence the reason why the first action gets the Initiators Display Name.

One thing to note, is that the Set a Variable action, even though the lookup part needs to compare Display Names, what it returns is the Login Name.

So the next part of the workflow that is important to note, is that if we want to go up the chain of managers, and we currently have the Initiators Managers Login Name, we don’t have a way to performing the next lookup.

To convert a Login Name to a Display Name, we can use the SharePoint UserGroup.asmx web service. It exposes a web method called GetUserInfo. This will return some XML that will contain the users Display Name.

Firstly, we use the Call Web Service to call the UserGroup.asmx web service.

Now that we have the Managers Display Name, we can store it in the textEmployee variable, and then continue on through our loop.

I have used the State Machine to loop through my list of Employee/Manager data, as I find it to be the easiest and most maintable way to design such a workflow. When I have time, I may write about the State Machine in it’s own blog article.

Workflow

Conclusion

There’s really not that much to go through in this workflow. It’s probably a little more complicated (visually) than the other workflows I have shown, but I wanted to focus this article of the concept rather than the whole workflow.

This is one way of dynamically getting approvers, and moving up a Management chain. Other ways, would be to query Active Directory, using Query LDAP. There is already a tutorial on Nintex Connect that explain how to do that. This is just my different take on this.

Files to Download

Download Workflow

Leave a Reply

Your email address will not be published. Required fields are marked *