Find your people. Pick a challenge. Ship something real. The CreatorCon Hackathon is coming to the Community Pavilion for one epic night. Every skill level, every role welcome. Join us on May 5th and learn more here.

If script in a workflow to check if list collector is empty

pothukuchirsnh
Kilo Explorer

I am trying to use an ifscript to check if a list collector selected values is empty or not. If it's not empty, I will generate tasks based on the selection.

Right now my script looks like this but I see a warning:

1 ACCEPTED SOLUTION

Try this (typo also corrected on line 2)



answer = ifScript();


function ifScript() {


var accessoriesList = current.variables.accessories.toString(); //convert the variable list to string


var arrayList = accessoriesList.split(",");



  if (arrayList.length > 0) {


            return 'yes';


  } else {


          return 'no';


        }


}


View solution in original post

7 REPLIES 7

Chuck Tomasi
Tera Patron

Hi,



There is no script attached.


Sorry about that



answer = ifScript();


var accessoriesList = current.variables.accessories.toSring(); //convert the variable list to string


var arrayList = accessoriesList.split(",");


function ifScript() {


  if (current.variables.arrayList.length > 0) {


  return 'yes';


  }


else   return 'no';


}


Try this (typo also corrected on line 2)



answer = ifScript();


function ifScript() {


var accessoriesList = current.variables.accessories.toString(); //convert the variable list to string


var arrayList = accessoriesList.split(",");



  if (arrayList.length > 0) {


            return 'yes';


  } else {


          return 'no';


        }


}


It's working, Thanks