Skip to main content

With the release of the Office 365 Query User Profile action, it opens up a vast array of possibilities.  One main piece of functionality that you can build in to your workflow, is the ability to get the manager of the current user.  Having said that, there are a bunch of other properties you can get which can make your workflow that much more dynamic and more powerful.

 

Not only are there the out of the box O365 user profile properties, but you can add custom ones if you need to.

 

For this post, I'm interested in just getting the manager, since in a lot of business processes you will be building out, the manager is the person you'll be looking to assign tasks to.

 

Workflow Designer

WorkflowDesign.png

 

How It Works

 

I've made the workflow, which in some cases would be fairly simple, a little more complicated.  That's because I want to show some other functionality also.

 

We start off with a Query User Profile.  When a workflow starts, it's in the context of the user who caused the event that started the workflow.  This user is the Initiator.  We can therefore use the initiators email address to query the User Profile to pull out the manager of this user.

 

QUPManager.png

As you can see in the screenshot above, I actually have a list I've created called constants which is where I would store some common values like the SharePoint Online Url and a Username/Password that has access to querying the user profile.  I am requesting the property named "Manager" and storing it in a Nintex Workflow variable called "textManager".

 

The result, is a value that looks like this :  i:0#.f|membership|brettc@ntxte01.onmicrosoft.com

 

The next thing I'd like to do, is use the Set Workflow Status action, to the status to something like "Task assigned to XXXXX", where XXXXX is the managers name.  I don't want to put in the whole i:0#.f... etc.  So now, we can use the Replace Substring in String action, to replace the i:0#.f| with a blank text variable, leaving us with an email address.

 

ReplaceSubstring.png

 

The result is then stored in another text variable called "textManagerEmail".

 

Now that we have the managers email, we can use another Query User Profile action, to query for the manager name (display name).

 

QUPManagersName.png

Not very difficult right?

 

Finally, we set the workflow status :

 

SetWorkflowStatus.png

So that when the workflow runs, the list will look like this :

 

ListView.png

You can now assign a task to the Manager using the Assign a Task action.

 

User Profile Properties

 

I found the easiest way to get to my Admin site for my O365 site, is to put a -admin at the end of my root site.

So if your site is http://mycompany.sharepoint.com, then your admin site is http://mycompany-admin.sharepoint.com.

 

Conclusion

 

The workflow for this post is attached here.  Feel free to download and try it out.  You will need to tweak the Query User Profile actions, because in my environment, they are configured to point to a list I have called Constants where I store the SP Url and the Username and Password I use for this workflow.

 

If you have other ideas of how you use the Query User Profile action, please share them.  I'm already excited to hear what solutions users are building.

Hi Paul,

The list I used, was just a custom list with no custom fields on it.  So this functionality would work, regardless of what SP list or library you are on.

It's actually querying the SharePoint User Profile itself.

cheers,

Vadim


Ohhhh that list

Ok, so that is just a SP Custom List with a Title field and a Value field, both of which are Single Line of Text.

Where Title is the name of the constant and Value is the actual value.

eg.

Username - abc@mysite.onmicrosoft.com

Password - myPassword

cheers,

Vadim


No problem.  Reach out to me if you get stuck.


Glad this helped Paul.


Hi Vadim,

Is there a similar method for doing the same in a Form? (O365) I need to have a default value of the Initiator's manager populate a person field when a new entry is being created.

Cheers,
Gerard


Hi Gerard,

I don't believe there is a way to do this out of the box.  Potentially with some JavaScript, but I'm not 100% sure on that.

cheers,

Vadim


Hi Saud,

agreed.  It's not the ideal way.  But if you wait for the next release, which is this month (June '15), we'll be exposing a Manager token, so you won't have to do the above work around.

cheers,

Vadim


Hi David,

we recently released the Manager token as a Common property, so that should make things a little easier.

Are you looking for a Query LDAP action for O365 or a simplified Query User Profile action?

cheers,

Vadim


Reply