Get manager from user with web service

This article will explain how you can retrieve the manager from a SharePoint user with the use of Nintex Workflow and web services.

In Nintex there is an option to at the manager via the insert reference screen. The manager that is selected here is the manager from the workflow initiator, if you need the manager from another user you need to get this first via a web service request or Active Directory Query.

*Note: It's only possible to use data that is available. If the field manager isn't filled in the user's Active Directory account or in the user profile service you need to find another method to get the data*

Create workflow

Drag the following actions on the canvas:

  • Web service action
  • Build string action
  • Query XML action
  • Build string action
  • Update item


The following variables need to be created:

  • UserInfoResult; single line of text
  • XMLResult; single line of text
  • Manager; Person or Group

Web service action

Open the web service action to configure this.

  1. On the URL field click on the address book and select the Web URL
  2. Manually enter the following behind Web URL/_vti_bin/userprofileservice.asmx
  3. Enter a username and password or select a Constant and click on the Refresh button.
  4. Select from the pull down field Web method the option GetUserPropertyByAccountName
  5. Fill the field accountName with the username field that contains the user you want to retrieve the manager from. We use a SharePoint field named User.
  6. The field propertyName must contain Manager.
  7. Select the variable UserInfoResult to store the result


Get Manager via Web service

Build string action

We are using the Query XML to retrieve the manager from the web service result.
As the Query XML action requires that there is only one root xml node you need to wrap this around a single root XML node.
Configure the build string action as followed:

 <xml xmlns="">

Store the result in the variable UserInfoResult.

Get Manager via Web service


Query XML action

Insert a Query XML action and configure it to get the manager name.
The following XPath is used:

Store the result in the variable XMLResult.

Get Manager via Web service


Build string action

The username that you receive from the XMLResult needs to be converted to a format that SharePoint accepts,
therefore the following text needs to be added in front of the XMLResult -1;#
Use the build string action to reformat the variable and store the new result in the variable Manager.



Update item

In our example we have a SharePoint field manager that we update with the variable manager.
Configure the Update item action that the current item field manager is updated with the Workflow Data Manager.

Get Manager via Web service


Save and publish the workflow.

Run the workflow

When the workflow is started this will trigger the web service request for the user and retrieve the manager from the User Profile Service,
convert it to a correct SharePoint name and set it in the current item.
This workflow can off-course also be extended with an option to get the manager from the manager etc.

Creating workflows with web service calls and XML queries can be complex, in one of the following blogpost we will look at how troubleshoot and test these type of workflows.

If you liked this article be sure to have a look at our book: Nintex Workflow User's Guide for more tips, tricks and hands-on assignments.


Leave a comment

Make sure you enter all the required information, indicated by an asterisk (*). HTML code is not allowed.


BleiCon can provide standard or customized Nintex trainings from end-user to administrators.

Discover what Nintex training fits your organisation


Meulenspie 21
4847 TK Teteringen


BleiCon is Microsoft Certified Partner


Bleicon is Nintex Workflow Pro certified

We use cookies on our website. Some of them are essential for the operation of the site, while others help us to improve this site and the user experience (tracking cookies). You can decide for yourself whether you want to allow cookies or not. Please note that if you reject them, you may not be able to use all the functionalities of the site.