Send Email through variable


Badge +4

Hi, I'm having some difficulties with Nintex. I created a list in SharePoint, that contains two fields: Department (which is a simple text) and Name (which is a person or group). What i want to do, is get the e-mail of some people from a certain department. So this is what i did:

1 - I created a Querry List block, so I can get employees of a particular department. I also select only the column "Name" from the list, and since it is a "person or group" I select the property "work email". This, is returned to a collection variable (but there will always be only one result that match my search, so the collection has only one item).

2 - The next step, is a "Get Item from Collection", and this seems to be the problem. The Target Collection field at the "Get Item from Collection"  is defined as my collection, obtained at step 1. Since it has only 1 value, its index has value 0. The "output" is a variable of type person or group. So considering this works, the next step should be really easy.

3 - The last block is a send email block. The target, is the workspace variable returned from step 2. The problem is that I'm never getting the e-mail.

Am I doing something wrong in the process ??

This is my simple workflow:

199478_pastedImage_3.png

Thanks for the help !!


10 replies

Userlevel 7
Badge +17

it sounds like it should work. I also have similar solutions and they work. Why don't you try to log to history outcomes of every action, so that you will know what data you have in your variables?

Regards,

Tomasz

Userlevel 3
Badge +9

If you will always only have 1 result from your query, why do you need a collection?  Just store the result from your query in a text variable, then drop that in your send notification. 

Userlevel 7
Badge +17

That situation occurs when SP field "People or Group" is set to be able to have multiple values.

If a field is set to contain only one value, then the returned value in Nintex would be a single "Person or group" not a collection.

However ‌ if you save a "Work e-mail" value as the output to the collection, then the element 0 may be as well a text value. Of course, you can assign it to "people or group" variable as well... In both ways that variable should be proper to send the e-mail.

Do you log the outcomes? Do you have any error in your workflow history? Maybe it gets suspended? Maybe the provided variable is different, than expected by the action? Maybe, in the end, account you are querying does not have filled in "Work email" field in SP User Profile? First thing - debug. To debug - log happy.png

Regards,

Tomasz

Userlevel 5
Badge +14

you need not to pick an email from collection to a variable.

setting mail recepient to collection variable should work as well (as long collection contain valid emails or user udentifiers)

Badge +4

Hi all, and thank for the help !!

I still haven't figured out what's happening. The workflow result is "completed", but the variable seems to be empty like in the photo below:

199545_pastedImage_1.png

Where Potential Approvers is the list returned from the query search, and contact is the item got from the collection.

Thanks, Igor.

Userlevel 7
Badge +17

I see no "work email" in the collection. Are you sure you are getting the work email? Are you sure this account has filed work email attribute? From this collection, to get the value you need, you should use the JSON path: "Approver_x0020_Name/Title" using the "Get element from collection" action.

Regards,

Tomasz

Badge +4

Hi Tomasz,

Yes, in the Get Collection Item I'm selecting the Work Email option. I really don't know whats happening here. The only way this is working is if i create a variable and type my name in its value field. This is the only way I'm receiving the e-mail. I tried creating the e-mail field in the list as a Text, not a Person or Group, and thats not working too. I'm thinking that the only way to make it work is by using a Regular Expression block, to extract the e-mail. But that seems to complicated for something that should be intuitive and simple. I made a lot of Log to History, and this are the results:

 

199632_pastedImage_1.png

First I query the items from the list, create the collection. After, I get the items from the collection.

Please, help me, I'm trying to solve this for days sad.png

Thanks !!

Userlevel 7
Badge +17

This is really weird. One additional question - the e-mail where you are trying to send your e-mail is in the same domain as your tenant? It is not an "external email"?

Badge +4

Hi all, and thanks for the help. I managed to solve the question. The option "Separate output per column" was not selected at the Query List block. This appears to have solve the problem. Thanks for all the help !!

Userlevel 7
Badge +17

‌ I'm glad you solved it. Please mark the most correct answer as the "Correct" so that other users will know that there exists a solution if they have similar problems happy.png Thanks!

Reply