could you explay me better the details to “how to” setup the ForEach configuration?
I need to configure For_Each1 task; where do I have to configure this parameter? And what is the exact “Condition” item sintax in the Work Flow.
I wish to check a body response, where more than of one item is returned.
ex. the http request is http://my.ipserver:9300/users?code=1971
the body response returns multiple name objects like this in json format
or like this in array format
And I want to compare the item name as “Lucy”, if exists in this array.
Please could you show me with screenshot, where these parameters (For_Each1) must be insert?
Each cooperation will be very appreciate
When you add the HTTP activity, by default it will be named Http_Request1, so the array of results that it returns can be referred to as Http_Request1.Body.
To set up a ForEach activity that goes through the array of results returned by the HTTP activity, you can do the following:
- Add a ForEach activity after the HttpRequest activity, and enter
Http_Request1.Body as the array value to search as shown here:
- As you iterate through the array, each item will be referred to as
- Inside the brackets of the ForEach activity, add a comparision to check if `For_Each1.Item.name == ‘Lisa’ as shown here:
- After the Match condition, you can take any action you would like.
The end workflow should look similar to this:
If you have any additional questions, just let us know.
Dear Pamaelliot you have done goal!!!
In my WF is not present the option “For Each” item.
In the picture the only option I can find
Please let me know I have to do to insert the “For Each” item, as in your image.
My apologies - I didn’t realize that the ForEach activity is not available in Voice Assist. We can accomplish what you would like to do by searching within the array results using a condition. I will test that out and then reply back with the updates for your workflow.
We can accomplish the same search function by doing the following:
- Add a new variable to your workflow of type Object, as shown below:
After your HttpRequest activity, add a Set Variables activity, which is setting the testobj variable to the return value with the name set to Lucy. Make sure it is an expression, with the value set to the following, as shown below: ArrayFind(Http_Request1.Body, ‘name == \“Lucy\”’)
Note that you need to add a \ character before each double quote around Lucy
If a return value with Lucy is found in the HTTP response, it will be contained in the testobj variable. Otherwise, the value will be null. You can add a Condition to check testobj.name after the SetVariables activity.
I hope this helps! Let me know if any questions.
All works fine now. Very well.
Just one more question (my curiosity).
What kind of tool you have used in your previos image where there were the “ForEach” item?
Is it another kind of PBX integration?
That’s only for my information.
That screenshot was of Workflow Studio, which is the UX for the Workflow service that Voice Assist is built on top of. Right now you can access a limited version of Workflow in order to configure Voice Assist, but in the future (next year) we plan to roll out Workflow Studio for our partners. This will give you access to additional features and functionality such as the “For Each” activity.
thanks a lot for the expalnation.
then let’s wait for the “new year”