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

Reverse lookup an Account Name from a User Profile field

Jump to solution

In essence what I want to do is look up a user's Account Name from the SharePoint User Profile Service by inputting another unique field. In this case it is a custom Employee ID field in the UPS that is read from AD, but it could be by phone number, or other fields.

 

To clarify, I am inputting an Employee ID number and wanting to extract the username that matches up with the Employee ID.

 

I've tried setting a variable as shown in the attached file, but that errors out with "Workflow failed to get user profile for user".

 

I have confirmed that the property is readable from the User Profile service in Nintex, by using a Query User Profile action, hard-coding a user in and emailing the Employee ID number.

 

Thanks for any advice!

Labels: (2)
0 Kudos
Reply
6 Replies
dyermull
Nintex Newbie

Re: Reverse lookup an Account Name from a User Profile field

Jump to solution

I believe I found a solution. I used a Query LDAP action to grab the displayName that matches up with the Employee ID. I can now work with the UPS using the displayName and Query User Profile action.

Not sure if there's a way to do this directly with the UPS or not, but the LDAP solution should work.

0 Kudos
Reply
thomas_xu
Nintex Newbie

Re: Reverse lookup an Account Name from a User Profile field

Jump to solution

Hi Josh.

 

Yes,"Query LDAP" should work. Another alternative to do this within a workflow is to use "Web Request" to make a "Get" REST service call.

 

http://siteurl/_api/SP.UserProfiles.PeopleManager/GetUserProfilePropertyFor(accountName=@v,propertyN...'EmployeeID')?@v='domain\username'

 

This applies to both SharePoint Online and on-prem.

 

More info can be found: Vardhaman Deshpande: SharePoint 2013: Get UserProfile Properties with REST API

 

I have used this to populate form data through javascript from clientside but i am sure this should work serverside as well.

 

Regards,

Thomas

0 Kudos
Reply
dyermull
Nintex Newbie

Re: Reverse lookup an Account Name from a User Profile field

Jump to solution

Thanks, I was curious if it could be done with the UPS directly. I'll try that out when I have more time. The LDAP query is working for me for the time being.

0 Kudos
Reply
thomas_xu
Nintex Newbie

Re: Reverse lookup an Account Name from a User Profile field

Jump to solution

My apologies. Yesh Query User Profile only accepts account name as input parameter .

0 Kudos
Reply
salahsaleh
Nintex Newbie

Re: Reverse lookup an Account Name from a User Profile field

Jump to solution

Hello Josh Lindemann‌,   Can you please let me know what query you used in LDAP action picker.

I have same requirement like yours, I need to pass EmployeeID and get Account Name. but only problem at my end is we have users from multiple domains. 

0 Kudos
Reply
dyermull
Nintex Newbie

Re: Reverse lookup an Account Name from a User Profile field

Jump to solution

Inside a For Each loop, I compare everyone in AD against the employee ID number. Inside the For Each there is a Query LDAP action that tries to match the Emp ID # to an AD account.

The query is simply: (employeeID={WorkflowVariable:varEmployeeID}) and the properties I'm retrieving when it finds a match are displayName and userPrincipalName

0 Kudos
Reply