Site Workflow help with Manager field


Badge +7

all,

I have a site workflow that queries a list to see if an employee has reached his or her 90 day mark and that sends an email to the applicable manager. I have a query list, then the for each loops through the employees that have reached their 90 mark today based on the hire date. The problem that I am having is, the manager (who is supposed to receive the email) only emails the first manager. so if  two employees have been hired 90 days ago today, the first manager received both emails. Any help on this would be appreciated.


32 replies

Userlevel 5
Badge +13

You should log the variable that you're getting before your "send notification" action and disable the email action for your testing until you are able to see what value you're getting. Can you open up your "set variable" action? I'm guessing this is where you get the employee's manager? In your "For Each" are you outputting some kind of index or ID?

Badge +7

here is the info. Is there a way I can just refer to the user profile and do everything from there?

Userlevel 5
Badge +13

Yes, using the user profile is the best way. Here are some helpful links:

User Profile action failing. Workflow status show Started however, the details of the workflow shows "Invalid text value… 

how to get sharepoint user's manager from sharepoint online userprofile? 

https://community.nintex.com/message/57992-re-send-a-reminder-to-the-assignes-manager?commentID=57992#comment-57992 

Badge +7

how do I relate it to the list I am currently trying to filter on? Also, can I add the variable as the User?

Userlevel 5
Badge +13

So, I would do the query and retrieve the ID of all the items that match your date case. Then, for each ID, output the ID (to use to iterate through). Inside your for each, you need a query user profile. To get the email address of the user you want to run the query on, you should use the "Advanced Options" and pick 

Source: yourListName

Field: yourUserField

when: ID

equals: workflow variable: variable you've stored the individual ID on

203331_pastedImage_1.png

203332_pastedImage_2.png

Your config may look slightly different as I'm in O365 but just give a holler if you can't get it sorted.

Ok, looking at the documentation here: http://help.nintex.com/en-US/nintex2013/help/#Workflow/RootCategory/Actions/Nintex.Workflow.QueryUserProfile.htm%3FTocPa… 

Yours looks different in On Prem. But you can do the same thing in your action now that you have the framework, I'm pretty sure .Again, let me know if this isn't clear enough.

Badge +7

Thank you. I've changed the query list to grab the ID and it populates in the queriedItemCollection:

. in the for each, target collection = queriedItemCollection (variable) and Store results in queriedItem (variable). I then have the query user profile:

is this correct?

Userlevel 5
Badge +13

It should be, give it a whirl, don't send the emails, just log the varManager in the workflow history and see if you're getting your expected values

Badge +7

ok I will try now. based on my query user profile info, can I only send the notification if the user is active? if so, would I do a run if?

Thank you so much for your help!!

Userlevel 5
Badge +13

Is it a possibility that the users in this list could be inactive? I don't think their manager(s) could be. Honestly, I'm not as familiar with On Prem as I'm exclusively in 365,  but perhaps ‌, ‌, ‌ or someone else could chime in on the best way to do this with your specific action configurations. It looks like, to me at least, that you're picking from a list of attributes you can retrieve on a user. Manager was the one you originally wanted so you would know who to send the email too, so I think you would only honestly need that one (assuming all users in this list will be active). I would just use that to set your managerVar and leave everything else how you already had it configured from the start with your notification and such.

Badge +7

I am getting the following error: "Error querying user profile. Object reference not set to an instance of an object." at the user profile.

Userlevel 5
Badge +13

According to the documentation for the action, you need to make sure you've configured your input for the query to be the login name:

203335_pastedImage_1.png

Your varEmployeeName should be the login name, not the display name, is that the case for your current configuration?

Badge +16

Have a look at ‌ where I am sure ‌ mentions a check to see if a user is a valid user - this may help. 

Userlevel 6
Badge +12

Hello D M‌ - 

Are each of your variables collection variables?

203340_pastedImage_1.png

I think you are on the right track here with Courtney Vargo‌'s help!

Here is how I would approach this (hopefully without confusing you happy.png)

  • Query List - get a list of all data points you need based on [hire_date] = [today] - 90
    • Each of these should be collection variables so we can loop through them later
  • For Each loop - loop through your collection (doesn't matter which one, I usually use [Title] or [Name])
  • Within the For Each loop
    • Run If [Active] = "Yes"
      • Within the Run If
        • Collection action - get all other pieces required (name, manager, etc)
        • Send Notification - at this point you should be able to send your notification to the specific manager for the active employee
    • end Run If
  • end For Each loop

I would also confirm that the User Profile services are returning accurate information. I have seen this used and later on it was discovered that there is missing data or it was not being updated properly.

Hope this helps!

Badge +7

it is the display name. I will update and reach out with the outcome. Thank you All!

Badge +7

so I've added the collection to get the manager. the Target collection works (ManagerNameCollection) works (I see both managers that would receive the email) however, the varManager is blank.

in the history I pulled the varManager, varManagerName and the ManagerNameCollection. Only the manager name collection has the two individuals and is not null.

Userlevel 5
Badge +13

What does your For Each action look like? And where are you setting/getting your index variable?

Badge +7

The above is the for each and here is the query list  (which comes before the for each)

Userlevel 5
Badge +13

Are you logging your index to make sure you're trying to grab the right manager from the collection?

Badge +7

I read somewhere that I needed to do that. if it's not necessary I will not happy.png 

Userlevel 6
Badge +12

What are your variable types setup as?

My guess is that they are mismatched and it is trying to add it to the variable (varManager) and cannot. Then, when you are going to query the varManager, since it is empty, varManagerName is coming back empty as well.

Badge +7

I see. so what should I do to get the correct manager? Sorry for all the questions. I'm stuck on this after trying so many different things.

Userlevel 6
Badge +12

D M‌ - 

No worries! You are in the right place to get help, trust me happy.png

I would add in some Log in history list actions into your workflow to confirm that the data is what you expect it to be and something is coming through. I know some of our fields in the user profile are blank and causes issues with workflows.

I made a quick workflow that queried a list with two items. I grabbed the [Created By] column in my collection (both are me happy.png) and I then looped through the collection to get the specific user into my variable. I then used that variable to query the user profile. I added logging after each step so that I can see what is in each variable for each loop through:

203388_pastedImage_7.png

Here is a quick sample workflow of what I did:

203356_pastedImage_4.png

You said you already did this, so I am wondering if perhaps the ManagerNameCollection data is not in the proper format to be used in your variables. Are you getting data in a format like domain/username ?

Badge +7

I am not trying to use the user profile I am trying to instead to the collection action. I do get both of the manager emails in the collection. I am not sure what to do after that (so the manager receives the correct email for their employee).

Userlevel 5
Badge +13

So if you're not using the User Profile query, where are you getting the Manager info from? Is that a column in your list that is already populated?

Badge +7

correct. it is a single line of text with the manager name. The issue I am having is that the first manager receives emails for both the employees. Instead of the second manager receiving the email for his employee.

Reply