Workflow Conditions based on list collector variable

Adarsh T
Tera Contributor

Hi,

I have a catalog item with one of the variables as a list collector. I have two options which are "Add / Modify Application Access" and "Get iManage Add-in". If I choose "Add / Modify Application Access" option then it should trigger an approval and catalog task etc, In the same way, if I am selecting Get iManage Add-in then it should trigger a different catalog task and the flow goes on. I have handled both the scenarios in my workflow with the switch.

The challenge I am facing is if I am selecting both the options then it should trigger both the flows. I handled that also inside switch as a condition but in spite of just triggering the both condition alone, it is triggering the other two conditions along with both. Hence it is creating a mess triggering multiple tasks and approvals. How to handle this if I am selecting both the values and it should trigger the flow accordingly?

Below are my conditions added inside the Branch activity:

Add / Modify Application Access- current.variables.request.toString().indexOf('f39a272a1b4fc1900dd7fdd91d4bcbd9') != -1

Get iManage Add-in- current.variables.request.toString().indexOf('a7aa272a1b4fc1900dd7fdd91d4bcb93') != -1

Both- (current.variables.request.toString().indexOf('f39a272a1b4fc1900dd7fdd91d4bcbd9') != -1) && (current.variables.request.toString().indexOf('a7aa272a1b4fc1900dd7fdd91d4bcb93') != -1)

 

Attaching the screenshot of the workflow.

1 ACCEPTED SOLUTION

You don't need to build logic by scripts:

Use if condition workflow activity and if script:

answer = ifScript();

function ifScript(){

var req = current.variables.request.toString();

if(req.indexOf('a7aa272a1b4fc1900dd7fdd91d4bcb93') != -1)

    return 'yes';

else

    return 'no';

}

Best Regards
Aman Kumar

View solution in original post

8 REPLIES 8

Rahul Talreja
Mega Sage
Mega Sage

Hi Aadarsh,
Can you please share code snippet of the Branch.

Most probably the cause of this malfunctioning seems to be in that script.

Please mark helpful/correct as applicable.
Thanks and Regards,
Rahul

Please mark my response correct/helpful as applicable!
Thanks and Regards,
Rahul

I haven't added anything to Branch instead I have added conditions as mentioned below:

Below are my conditions added inside the Branch activity:

Add / Modify Application Access- current.variables.request.toString().indexOf('f39a272a1b4fc1900dd7fdd91d4bcbd9') != -1

Get iManage Add-in- current.variables.request.toString().indexOf('a7aa272a1b4fc1900dd7fdd91d4bcb93') != -1

Both- (current.variables.request.toString().indexOf('f39a272a1b4fc1900dd7fdd91d4bcbd9') != -1) && (current.variables.request.toString().indexOf('a7aa272a1b4fc1900dd7fdd91d4bcb93') != -1)

Aman Kumar S
Kilo Patron

Hey,

Can you share the complete code, for to be able to understand?

Best Regards
Aman Kumar

I haven't added anything to Branch instead I have added conditions as mentioned below:

Below are my conditions added inside the Branch activity:

Add / Modify Application Access- current.variables.request.toString().indexOf('f39a272a1b4fc1900dd7fdd91d4bcbd9') != -1

Get iManage Add-in- current.variables.request.toString().indexOf('a7aa272a1b4fc1900dd7fdd91d4bcb93') != -1

Both- (current.variables.request.toString().indexOf('f39a272a1b4fc190