cancel
Showing results for 
Search instead for 
Did you mean: 
Highlighted
kelliganp
Nintex Newbie

How can I get the current user's Manager with Web Request Control (Forms)

Hi Folks,

I just got Nintex Forms and I need to figure out how to use a Web Request Control to get User Profile information. As a test case, I would like to add the control to my form configured as label or text to show the current user's manager. Can anyone demonstrate how that is done?

Thanks and Best Regards,

Patrick

Labels: (3)
Tags (2)
0 Kudos
Reply
13 Replies
Automation Master
Automation Master

Re: How can I get the current user's Manager with Web Request Control (Forms)

You can use an expression and in the for builder query the user profile?

Reply
kelliganp
Nintex Newbie

Re: How can I get the current user's Manager with Web Request Control (Forms)

Thanks for the reply Cassy Freeman,

I am new at forms. Can you screenshot what you are talking about?

Thanks!

Reply
Automation Master
Automation Master

Re: How can I get the current user's Manager with Web Request Control (Forms)

Hi

Sorry about that, I was replying off of my phone so I couldn't shoot you any screenshots...

This is the control you are looking for in your toolbox on nintex forms:  Calculated Value.PNG

Drag it to where you want it on the form and double click it to configure.  Use the formula builder button to access named controls and the inline functions such as userProfileLookup.

In the below image, we are pulling the manager of the person entered into the "RequestedBy" named control.  We are then doing a userProfileLookup of that returned value to get the display name for the manager:

userProfileLookupFormulaBuilder.PNG

with the formula userProfileLookup(userProfileLookup(RequestedBy,"Manager"),"PreferredName")

if you wanted just the manager you would use:

userProfileLookup(RequestedBy, "Manager")

and if you don't want to look for the manager of the person chosen inside a control, you could replace RequestedBy with the Current User under the common tab in the formula builder.

Hope that helps... 

Reply
kelliganp
Nintex Newbie

Re: How can I get the current user's Manager with Web Request Control (Forms)

Hi Cassy,

We have actually had success with the userProfileLookup function. What I am trying to do is "figure out how to use a Web Request Control to get User Profile information" so that I can apply it to more complex solutions. I am hopeful that if I can make it work for something as simple as pre-populating a users profile data, I will be able to build on that knowledge and do things like automatically provision a new user based on roles that they are assigned from an Access Web App.

Do you have an idea on how to get the Web Request working? Incidentally, once I have gotten a handle on web requests, I will be digging into SQL Request controls. (Just incase you have expertise in that area...)

Thanks and Regards,

Patrick

Reply
Automation Master
Automation Master

Re: How can I get the current user's Manager with Web Request Control (Forms)

Patrick Kelligan​ ah I got you...  sorry about that!  Unfortunately I cannot be much more help in this instance but watching with interest to the thread now.  Keep me posted with whatever you find please?

0 Kudos
Reply
kelliganp
Nintex Newbie

Re: How can I get the current user's Manager with Web Request Control (Forms)

No problem and Thanks Cassy Freeman. Will do!

0 Kudos
Reply
Automation Master
Automation Master

Re: How can I get the current user's Manager with Web Request Control (Forms)

Hi Patrick,

I managed to perform what you'd like to do with SharePoint 2013 OnPrem.

Firstly, I created a calculated value named CurrentUserLoginName with the following formula (Current User is the reference that you can found in Common tab and replace is the reference that you can found in Runtime Functions tab):

     replace(replace(Current User,":","%3A"),"#","%23")

Here's how I configured the Web Request control on Nintex Forms:

  • Display format: Label
  • Service Url (Site URL is the reference that you can found in Common tab and CurrentUserLoginName is the reference to the calculated value control that you can found in Named Controls tab): Site URL/_api/sp.userprofiles.peoplemanager/getpropertiesfor(@v)?@v='CurrentUserLoginName'
  • Request method: GET
  • Authentication type: Windows authentication
  • Secure Store target application ID: myTargetAppID
  • XPath for display: //*[local-name()='Key' and .='Manager']/../*[local-name()='Value']

Tell me if you have any problems with this solution.

Hope it works on your environment

Reply
kelliganp
Nintex Newbie

Re: How can I get the current user's Manager with Web Request Control (Forms)

Hi Caroline,

Great Response. Here is what a straight "Current User" renders for me (no quotes):

""

Does this impact what I should use in the replace function? What should the string look like when the replace is complete?

Thanks!

Patrick

Reply
Automation Master
Automation Master

Re: How can I get the current user's Manager with Web Request Control (Forms)

it should look like this for the following login name :

i:05:t|adfs with roles|user@domain.com

i%3A05%3At%7Cadfs+with+roles%7Cuser%40domain.com

You should replace @ by %40 and I think that's all.

I didn't managed to replace | by %7C but it worked for me if this character is in the url.

You can type the url in the browser (Chrome) and you should get a response or an error if something is wrong.

Hope it works

Reply