T
Twenty2mo ago
kyrpav

Workflow loops

It seems that loops are released but i am not sure if they are working as expected or i will need to learn how to make them. First running a workflow for 3 records selected still runs 3 workflows. Second is about real usage and how to implement. I want to have list of people selected , then the user selects a campaign that he needs to add this people and then the iteration starts. The iteration checks if each one of the users is not already in the campaign members list and if not it adds them. and i am geting several json errors trying to setup the iterator with [] [id] which is the selection of some field from the Launch manually node. It seems that i can not select the record it self but some field under it. Maybe i am doing it completely wrong
No description
No description
No description
No description
32 Replies
Prastoin
Prastoin2mo ago
cc @Baptiste Devessier @thomast
kyrpav
kyrpavOP2mo ago
Even when i try to change the iterator and i try to select to iterate from the select campaign node i get some selection "add people to campaign" that i am not sure who it is created. cause it is not a workflow and the campaign model does not have access to people it has connection to campaign members which is where i try to create the new records
No description
bt747
bt7472mo ago
Same for me unable to get the value of the current Item. Even passing the whole item in JSON Object array didn't work or just passing a array item also don't work
No description
Prastoin
Prastoin2mo ago
cc @thomast
[S05] Sterb4
[S05] Sterb42mo ago
First, I didn't manage to make any workflow with a filter in loop work. The filter outputs nothing if conditions are false, so the loop remains running, waiting to receive the signal to continue that will never come. For the launch manually, select the bulk option, it return an array. Remove the existing [] and add the array from bulk launch manually
kyrpav
kyrpavOP2mo ago
should we open bug or not?
Prastoin
Prastoin2mo ago
cc @Baptiste Devessier
Baptiste Devessier
Hi! Could you share how you created your workflow? You should be able to get the value of the current item. Are you still blocked?
kyrpav
kyrpavOP2mo ago
yes nothing i do not know how to fix or what i missed. have you made any update on system after 1.7.6? or is the version correct and the proper implementation needs to be found?
bt747
bt7472mo ago
Yes. Sorry got busy will share a video recording shortly.
thomast
thomast2mo ago
Hi all, here are a few inputs on how to use iterators: - as @[S05] Sterb4 said, you need to set bulk availability on the manual trigger so only one workflow is triggered - then you only put the trigger output into the iterator, in my case Companies without braces - finally, iterator will provide as output the current item which will be a company. All company fields should be available as usual Adding screenshots. About the filter issue, this is indeed not supported today since it stops the whole workflow instead of stopping only the iteration. It should be available in the next release - 1.10 coming end of next week. This is why iterators are still in the lab, there are missing features. Thank you all for your feedbacks. Let me know if I did not answered for something!
No description
No description
No description
kyrpav
kyrpavOP2mo ago
Thank you @thomast i knew that something was not set properly from my side. Iteration is in general working, i will still wait for the filter solution cause i am also filtering and i have the same issue with @[S05] Sterb4 . if the filter is false i can not set it to continue the iteration. The filter needs 2 outputs.
bt747
bt7472mo ago
Itterator only worked with records? Can I just use a code to generate a array and itterate using that ? Please look at the sample. I have code that generates a JS array and I want to use the array to create new records
No description
No description
No description
No description
Prastoin
Prastoin2mo ago
cc @thomast
kyrpav
kyrpavOP2mo ago
i know what @bt747 add is also extra requirement but looking at the initial to place them in order there are 2. The firsti is the filter issue and also the second is the iterator over created list in javascript. Do we have timelines ?
thomast
thomast2mo ago
You can use the full current item. Backend support already this case but frontend does not. It means that when you will select the current item, you will see Not Found as the variable. But if you run your workflow it will work. See screenshot. But you cannot select field of your current item - for example, select milestoneName in yours. I need to dive into that issue, this is definitely something that we should support Filters should be good for 1.10 release, planned end of this week or early next week
bt747
bt7472mo ago
Is there a syntax that I can use to get the item. I don't worry about getting about to select. Are you using Jinja or something else ? Ex: if I type in {{currentItem.milestone}}
thomast
thomast2mo ago
syntax will be {{ iterator_step_id.currentItem..milestone }} for the step id you can have a look in the findOneWorkflow call in your network. Or log it from the code
bt747
bt7472mo ago
Thank you will give this a try
bt747
bt7472mo ago
@thomast it worked. But only worked for texts. When there are numbers or dates we are getting null. Even though I saved correctly for numbers and dates they are being cleared in the node
No description
No description
No description
thomast
thomast2mo ago
Interesting, thanks for checking. I actually implemented the sub-field selection from current item, even when coming from a code step. So it will fix the issue for dates and numbers. Will be available in next release 👍
kyrpav
kyrpavOP2mo ago
Hi @thomast i have seen in the new release the changelog and you have https://github.com/twentyhq/twenty/commit/cbfd73cbd8ce8cb355c8287a6ca4ddbd5a4f4f6f fixed the filter. but it seems i did not understand how to fix it in user interface . do we have a selection somewhere cause from my side i do not see something changing in use interface to deal with the case that you need to apply the continue; to the next iteration
GitHub
Enable filters in iterators (#15017) · twentyhq/twenty@cbfd73c
Filters should not cut the whole workflow. These should only stop the branch. This PR: - adds a new skipped status - when a filter stops, it still goes to the next step - the next step will execut...
thomast
thomast2mo ago
The filter will do a continue by default if the condition is not matched
kyrpav
kyrpavOP2mo ago
thx i guessed something like this happens but it is always better to confirm thank you very much
thomast
thomast2mo ago
You're welcome, let me know if you find issues!
kyrpav
kyrpavOP2mo ago
ok nicely done thank you
bt747
bt7472mo ago
Hello @thomast I have upgraded to the latest version. I’m still having same issue. Unable to select the current item. Is the fix been released or still. Waiting.
Version 1.8.2
thomast
thomast2mo ago
Hi, please provide details and screeshots, we discussed several issues in that thread 🙂
thomast
thomast2mo ago
can you try to re-create your iterator node, or at least remove and put back the variable you set in items? This is how the output of the iterator is re-generated
bt747
bt7472mo ago
Thank you re-creating worked. Found a weird issue. When we create the records with the currency in this case it showed 0 value when I clicked to edit it showed the correct value. Please see attached screen record
bt747
bt7472mo ago
@thomast

Did you find this page helpful?