Error with For each in nintex workflow

  • 31 August 2016
  • 9 replies
  • 9 views

Badge +7

Hello,

I am using nintex 2013 and I want to loop through a collection. At first I have the collection action. I added a field to the collection of the current item the workflow is running on (type: person or group). In my example there are two persons in the field. The For each action should send a notification to each person (and when this is working do some more stuff). I get the error:

Coercion Failed: Unable to transform the input lookup datat into the requested type.

What should I do? Is this possible (people collection and looping through it..)

Thank you!


9 replies

Badge +8

Hi Nina,

You would want to add more details to your problem, generally the above error occurs if there is a data type mismatch with what you are trying to store in the variable.

If I understood you correctly you have a field which has more than 1 person and you need to send email to all of them. Not sure why you would want to loop through it and you could directly send notification and add the field name as reference in the "To" field. It should then automatically send notifications to all the people in the field. Is that correct or did i get your problem wrong?

Regards,

Shrini

Badge +7

Hi, thanks for your answer!

The problem is that I don't just want to send a notification, that's just what I did to try whether its working or not. Later I want to add more actions within the loop. Do you think this should be possible in some way?

Badge +8

HI Nina,

This can be achieved, I have used this in the past.

Mult_AdditionalPeople - Field of type people (multi) - Assuming you are extracting information from this field

txt_People : Temporary people variable to be used. This is the variable where you can store the extracted people from the above field.

CollPeople - Collection variable

1)Reg Expression Action - Use this action and configure the following properties -

Pattern - ;

Operation : Split

Input text : Select the field which has the multipeople (Mult_AdditionalPeople )

Store Result in : CollPeople

2) ForEach Action

Target collection - CollPeople

Store Result in: txt_People

In the foreach action you can add any actions or do operation on the txt_people.

Regards,

Shrini

Please mark this as answered if it has solved your question

Badge +9

Hi,

I had iterated people from the collection using this blog Nintex Workflow - Iterate through Related Collections - Vadim Tabakman  .Please check

Badge +7

Its working fine. Thank you!

And the error was coming from another action I wasn't thinking had something to do with the error (a create item action).

Badge +7

Sorry, I have one last question!

I followed all the steps and in my loop there is a Create Item action.

It is creating an item with an individual title and the person (txt_people - a people variable) should be filled in a column that is also type people or group.

But it doesn't work, I always get the error

The workflow could not update the item, possibly because one or more columns for the item require a different type of information.

(or unknown error)

Do you have an idea why? :/

Badge +8

HI Nina,

The error is most likely due to column type mismatch. Can you try to drill down on the issue? Like only do create Item with Title updated, see if if gives an issue, then try to add the People column and see if that's the column that giving you an issue? I have created records using the same variable and populating people field without any issue, so I guess it could be that we are not assiging the correct variable type?

Try drilling down the issue and let me know which column update is exactly causing the issue.

Regards,

Shrini

Badge +7

Found the problem! The column was person or group, only persons from ...(changed it to all) and then the error disappeared, but the column was still empty and then changed show 'last name' to 'full name' and then it appeared. So I had those two mistakes in the column settings. Thank you, I'm glad its working now!

Badge +8

Hi NIna,

No worries .. glad could help you.

Regards,

Shrini

Reply