Complex Flow with flow variables in flow designer
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
07-07-2023 10:38 AM - edited 07-07-2023 07:50 PM
Greetings everyone
Iam tasked with designing workflows for intricate business processes and using flow designer to develop the flows. As part of this task, I encounter numerous conditional loops where various values are updated, and in certain scenarios, the flow terminates. I have contemplated two approaches to tackle this:
Creating flow variables and assigning them values within each loop. The subsequent actions can then be determined based on these flow variables. This method ensures that there is only one update action at the end of the flow, which I believe would be easier to monitor and manage.
Incorporating the update action within each loop. While this approach may result in multiple instances of the update action being called, it might simplify the development process.
can you help me with the best practice on this ? what is the best approach ?
Thank you.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
07-07-2023 11:52 AM
Hi @Community Alums ,
Hope you are doing great.
The recommended approach would be to create flow variables and assign them values within each loop. This method ensures that there is only one update action at the end of the flow, making it easier to monitor and manage. By using flow variables, you can store and update values as needed throughout the loop iterations, and then make decisions based on these variables to determine the appropriate actions.
Reference script to embed the logic :
var flowVariable1;
var flowVariable2;
for (var i = 0; i < loopIterations; i++) {
// Perform operations within the loop
if (condition1) {
flowVariable1 = value1;
} else {
flowVariable1 = value2;
}
if (condition2) {
flowVariable2 = value3;
} else {
flowVariable2 = value4;
}
}
// Perform the update action based on the flow variables
if (flowVariable1 === value1 && flowVariable2 === value3) {
// Perform update action 1
} else if (flowVariable1 === value2 && flowVariable2 === value4) {
// Perform update action 2
} else {
// Handle other scenarios or perform default action
}
Regards,
Riya Verma
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
07-07-2023 07:47 PM - edited 07-07-2023 07:51 PM
@Riya Verma - The question is on the flow designer and not on the script.Any idea?
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
07-16-2023 02:05 PM
Hi can you show some Errors/Logs or Pictures where we can help you then out ?
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
07-16-2023 04:48 PM
Without more details on the context where you are implementing this, I would recommend going with approach 1 unless you need the update to drive other logic.
Minimize the number of updates on the actual record as it would slow down the instances and will cause a headache as more records get processed simultaneously