You are viewing limited content. For full access, please sign in.

Question

Question

Lookup based on multi values field to return multiple responses

asked on August 26, 2019

I'm trying to run a simple workflow to lookup some values from a table based on a multi value field in a template.  I originally wanted to do it as a Dynamic field on a template - but since the field could have anywhere from 1 to 10 values and I need to return all the data this didn't work. (Essentially I want to enter an ID number and return Lastname and Firstname)

When I run my workflow it seems to go into a spiral and won't complete (if there are values in the ID field or not)  I branched the workflow so it would only run if the ID field had content - but it still isn't completing the workflow.

Also if someone goes back and adds an extra ID to the field it duplicates the first entries firstname/lastname and then adds the new one to the end.  I hope this makes sense, I've attached a screen shot of my workflow - which has gotten more complex than I think it needs to be, but I was trying different things to get it to work.

populatefieldsworkflow.PNG
0 0

Replies

replied on August 26, 2019

First note, you should not be using a conditional parallel, you should be using a conditional sequence, unless you want to "terminate" the workflow in one path in which case you would use a conditional decision.

Based on your description, it should never hit both branches, so there is no need for a parallel. Also, if you do a conditional sequence and the condition is not satisfied, it would just end the workflow based on how you currently have it configured so there wouldn't be a need for a branch to specifically end it.

Also, the End Workflow 2 is unnecessary and prevents the workflow from ever getting to the natural end point (the stop sign).

Some follow up questions:

What exactly do you mean when you say it goes into a spiral?

What activities are getting repeated more than you expected?

What token/values are you using for the For Each Value loop?

0 0
replied on August 26, 2019

Yep, I've removed all the branching - I knew it wasn't necessary - I was just making sure that it wasn't causing it to run like crazy if I had no ID number.  I should not have posted that version.  I'm going to attach the version I working with now and then I will show how it looks when I run it.

With this one I will end up with two firstname entries and two lastname entries - but they are both the same and match the first ID in my multivalue field.

populatememberdetailsworkflow.PNG
populatememberdetailsoutcome.PNG
0 0
replied on August 26, 2019

It always seems to hang on either the Query data task or the Assign Field Values task depending on how I've played with the workflow.  In this particular case it is looking up two IDs that both come from the same multivalue field and should return 2 firstnames to the FirstName multivalue field and 2 last names to the LastName multivalue field.

0 0
replied on August 26, 2019

I assume you're using the field values result for the For Each Value loop, but I'm still not 100% clear on what you're using for the Query parameters, or what tokens are being used to set the field values in the Assign Field Values activity.

It sounds like you're using the wrong token somewhere if you're getting the same values multiple times rather than getting different values for each loop iteration.

0 0
replied on August 26, 2019

Can you show us the properties of your Query Data activity?

0 0
replied on August 26, 2019

You are right Jason, it doesn't seem to be updating the member details token when it loops through for the second value.

I've attached my query criteria.  and I'm going to go have a look to make sure I'm not amending my token update within the loop.

query.PNG
query.PNG (38.39 KB)
0 0
replied on August 26, 2019

Here are the details of the update token within the "for each value" loop

updatetoken.PNG
updatetoken.PNG (24.61 KB)
0 0
replied on August 26, 2019

Editing the field however I Append the existing values which I believe should be correct.

0 0
replied on August 26, 2019

The first thing I notice is that you’re using the token for the field values in the query, not the value from the current value of the for each loop iteration.

As a result it is using the same value each time, not actually looping through the field values.

1 0
replied on August 26, 2019

I think you got me there!  I needed to set it to look at the current value.  It is giving me the correct outcome now.  I still have some workflow that remains blue when I run it - so I'm not sure it is completing correctly - but it is filling in the data correctly.

0 0
replied on August 26, 2019

The blue just means it is an active activity. Press F5 to refresh. You have a loop so the most likely thing is that you start it and it isn’t quite finished when it loads that part of the view.

0 0
replied on August 26, 2019

argh, it works if I just run it on an item from the workflow - but when I try to trigger it via a starting rule it loops and it loops because I'm triggering it on change and the update of the field is a change...

0 0
replied on August 26, 2019

You need to exclude the Workflow user account from the starting rule.

0 0
replied on August 26, 2019

thank you!

0 0
replied on August 26, 2019

It's perfect - thank you Jason!

0 0
You are not allowed to follow up in this post.

Sign in to reply to this post.