Join us Dec. 16 for The Community Hour, our first global virtual User Group event!

(Flow Designer) How to make a condition to check if array is empty or not ?

ericlung
Tera Contributor

Hello,

 

I have make a flow condition in order to check if the array is empty or not ?

But when launch the test , it always return true evaluation in my flow and it always trigger the next action but I don't know how to do it ?

 

Screenshot Flow Condition :

FlowCondition.png

 

Screenshot of test :

ericlung_0-1686911275428.png

 

 

1 ACCEPTED SOLUTION

Riya Verma
Kilo Sage

Hi @ericlung ,

how you can implement this in Flow Designer using JavaScript code:

  1. Add a "Script" step in your flow after the array is populated.

 

var myArray = current.myArray; // Replace "current.myArray" with your array variable
var arrayLength = myArray.length;

​

 

  • Add a "Flow Condition" step after the script to check if the array length is equal to zero .
  • Configure the subsequent action to be triggered when the condition is true

View solution in original post

3 REPLIES 3

Michael Fry1
Kilo Patron

I think the last one is messing you up but I don't think you need 3 checks. Just have - is not - and then leave the field empty. Does that work?

Riya Verma
Kilo Sage

Hi @ericlung ,

how you can implement this in Flow Designer using JavaScript code:

  1. Add a "Script" step in your flow after the array is populated.

 

var myArray = current.myArray; // Replace "current.myArray" with your array variable
var arrayLength = myArray.length;

​

 

  • Add a "Flow Condition" step after the script to check if the array length is equal to zero .
  • Configure the subsequent action to be triggered when the condition is true

ricker
Tera Guru

@ericlung,

Your test results and Flow screenshot show different logic on the 3rd condition.   You're using OR, change to AND instead.