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
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.
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.
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).
Not very difficult right?
Finally, we set the workflow status :
So that when the workflow runs, the list will look like this :
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.