list collector variable in flow designer

Mansi roy
Tera Contributor

Hello, Can anyone please help on the below requirement. I have one list collector variable which is referring to user table. I need to give the condtion in flow designer is if that list collector variable does not any value then task will not get create if it contains value task will get create.I have directly like variable is not empty but it is not working. Can anyone please help me how to give the condition in flow designer.

2 REPLIES 2

James Chun
Kilo Patron

Hi @Mansi roy,

 

Can you share some screenshots of your Flow?

And what do you mean by it's not working?

 

Cheers

Dnyaneshwaree
Mega Sage

Hello @Mansi roy ,

Check by adding script action to check the value present in that list collector variable or it is empty:
Action script example(update it as per your req.):

(function execute(inputs, outputs) {
    // Get the list collector variable value
    var listCollectorValue = inputs.listCollectorVariable;

    // Check if the list collector is empty
    if (listCollectorValue && listCollectorValue.trim() !== '') {
        // List collector has values
        outputs.taskShouldBeCreated = true;
    } else {
        // List collector is empty
        outputs.taskShouldBeCreated = false;
    }
})(inputs, outputs);

 

Define an input for the script action to accept the list collector variable value and Define an output to store the result of the condition check (taskShouldBeCreated).
After the script action, add a "Decision" step. Use the output from the script action (taskShouldBeCreated) to decide whether to create the task or not.
In the decision step, create two branches: One for when taskShouldBeCreated is true (create the task). Another for when taskShouldBeCreated is false (do not create the task).

 

 

Please accept my solution if it works for you and thumps up to mark it as helpful.
Thank you!!

Dnyaneshwaree Satpute
Tera Guru