cancel
Showing results for 
Search instead for 
Did you mean: 

Assigning a Task to an Office 365 Manager

Nintex Employee
Nintex Employee
6 14 4,052

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.

14 Comments
Not applicable

Vadim,

This looks like exactly what I need to solve a problem I am having in building a workflow.

The One thing that is not clear to me is how to build the list. Do you happen to have a screen shot of what the list should look like?

Thank you,

Paul Gemme

Nintex Employee
Nintex Employee

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

Not applicable

Vadim,

Thanks for your response…

So, in your post you mention,

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".

I don’t need to create this? I guess I’m confused as to how to configure the action.

Paul Gemme

Nintex Employee
Nintex Employee

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

Not applicable

Ah,

OK- I’ll try that. If this works I will be  very happy!  Very  new to Nintex and workflows in general, and struggling to get this done…

I sincerely appreciate your expertise and help, and will make sure to post the success…

Paul Gemme

Nintex Employee
Nintex Employee

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

Not applicable

Vadim,

This is working perfectly. Thank you for sharing your knowledge and expertise.

Paul

Nintex Employee
Nintex Employee

Glad this helped Paul.

gerardh
Nintex Newbie

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

Nintex Employee
Nintex Employee

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

Not applicable

hi,

you are saving the user/pass in "constants" list which you have to allow "initiator" to read, as the workflow is running under the "initiator" principal.

isn't that a security risk, and is there a better solution like "site level constants in nintex on-prem"

Nintex Employee
Nintex Employee

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

Not applicable

The Nintex forms for O365 should have a UserProfile service call just like on premise.  The fact that on "form load" I can't immediately return any AD attribute in the UPS, including for example, manager, department,  job title, extensionAttributes creates a lot of development overhead.  How soon do you expect to have a simple way to return these other elements the same way I'm able to use "Display Name" or "Current User (Email)"?

Nintex Employee
Nintex Employee

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