Solved

workflow halt if using get item from collection when count is zero

  • 11 September 2020
  • 2 replies
  • 78 views

My workflow simply stops if I try to get and item from a collection and the collection is empty or the collection count is zero. Does anyone else have this problem?

 

I'm using a Regular Expression to get the the comment from a LazyApproval reply into a collection.

If the LazyApproval does not contain a comment (no , and comment) the collection is empty or has a count of zero.

When I use the get item from collection and get item zero if there is no comment (collection empty) the workflow simply stops dead in it's tracks.

 

Does anyone experience this problem? Is this how the get item from collection action is supposed to work? 

 

I've switched my workflow to test if item count is zero before running the get item to circumnavigate this problem, but that adds a number of actions that frankly I think are unnecessary. Shouldn't the get item from collection just return null if the collection is empty and allow the workflow to continue?

 

Thanks for any input into this.

icon

Best answer by SimonMuntz 14 September 2020, 03:15

View original

2 replies

Userlevel 6
Badge +22
Hi,

This sounds like expected behavior to me.
Basically a collection is an array. In programming if you were to say get me an item from the zero index of an array and the array is empty you will get an error. Checking to make sure the collection variable contains data by using a collection operation that does a count is only 1 extra action and a run if is only a second extra action do get around this behavior.

Thanks Simon, this makes sense ... just needed confirmation.


 


Hey Nintex documentation - This might be helpful to note in the documentation; that querying an empty collection will cause get item from collection to halt the workflow.

Reply