Hi community !
In a custom object, I have a list of contact objects. On a specific signal, I need to loop over these contacts and change the attributes of each contact based on other attributes found in the contact object. How can I achieve the for loop with a business process?
If the only way is to use the Scripts element, where can I find proper documentation to start using Scripts in Creatio?
Like
Dear Julien,
Thank you for your question!
The best way to create a Business Process with a for loop you would need to create a sub-process:
Signal "Contact Added" element:
Read Data "Read Contact" element:
For the sub-process, you would need to specify the [Parameters] of it:
And make a filter of the element within the sub-process based on the ID:
And finally, you would need to specify this parameter in the parent Business Process:
This is it. The business process here would trigger upon a Contact being added, then it would fetch 50 top Contacts in the system and transfer them to the sub-process, which will do some required magic within it, and then would end.
You may customize this example in any way you would like.
You may also find these academy Articles useful:
https://academy.creatio.com/docs/user/bpm_tools/process_elements_refere…
https://academy.creatio.com/docs/user/bpm_tools/bpm_process_examples/us…
Hope this helps!
Thank you!
Regards,
Danyil
Hello Julien,
A common way to loop through records in a process is to use a flag field to mark the records to loop through and then un-flag them to move to the next record in the loop. See https://customerfx.com/article/how-to-loop-through-records-in-a-process…
Another method to do this is to read a collection of records that get passed to a sub-process. The sub process gets called for each record in the collection. See https://customerfx.com/article/working-with-a-collection-of-records-in-…
Ryan
Dear Julien,
Thank you for your question!
The best way to create a Business Process with a for loop you would need to create a sub-process:
Signal "Contact Added" element:
Read Data "Read Contact" element:
For the sub-process, you would need to specify the [Parameters] of it:
And make a filter of the element within the sub-process based on the ID:
And finally, you would need to specify this parameter in the parent Business Process:
This is it. The business process here would trigger upon a Contact being added, then it would fetch 50 top Contacts in the system and transfer them to the sub-process, which will do some required magic within it, and then would end.
You may customize this example in any way you would like.
You may also find these academy Articles useful:
https://academy.creatio.com/docs/user/bpm_tools/process_elements_refere…
https://academy.creatio.com/docs/user/bpm_tools/bpm_process_examples/us…
Hope this helps!
Thank you!
Regards,
Danyil
Danyil Onoprienko,
I tried creating a for loop by using a flag but there the process stops after 100 records because there is a limit to each element.
If I'll create the subprocess option, will that resolve the problem?
Thanks,
Chani
Hi Chani,
In the process parameter you can specify the maximum repetition number for the process. If you put nothing, it will read the all collection.
Late answer !
nico