How to evaluate multiple choice variable in workflow

chrish5
Giga Guru

I have a catalog item variable of type Lookup Select Box called "Applications" that has about 20 choices in its dropdown list.   This variable is pulling its options from a column in a custom table I created.  In my workflow, I've tried using a switch to evaluate this variable, but it won't list the options.  I've used switches in many of my workflows, but they have been for Select Box type variables and never for Lookup Select Box type variables.  Is this not possible?  

 

As a workaround, I tried resorting to the "If" condition in the workflow and going beyone the usual 'yes', 'no' options with the multiple options shown below, but have been unsuccessful in getting this to work.  

 

Looking for any suggestions on getting either my Switch or If condition to work correctly.  Thanks!

 

chrish5_0-1701118611134.png

 

 

 

answer = check();
function check()
{
if(current.variables.application == 'Test 1') {
return 'test 1';
}
if(current.variables.application == 'Test 2') {
return 'test 2';
}
if(current.variables.application == 'Test 3') {
return 'test 3';
}
}

 

 

 

1 ACCEPTED SOLUTION

chrish5
Giga Guru

I ended up being able to do this via the Run Script activity with conditions that match the activity.result. 

 

if(current.variables.application == 'Test 1') {

  activity.result = 'test 1';

}

if(current.variables.application == 'Test 2') {

  activity.result = 'test 2';

}

if(current.variables.application == 'Test 3') {

  activity.result = 'test 3';

}

View solution in original post

6 REPLIES 6

Alp Utku
Mega Sage

What are you trying to achieve?

I need to evaluate the Application variable and take different paths in the workflow depending on what was selected.  These different paths will go to different approval/review groups.  Hope this clarifies my objective enough.  

You can use switch activity and select the relevant variable to be used on the switch activity. 

 

I've tried the switch, and it just looks like this.  I'm wondering if this is because the Application variable I have designating in the switch is a Lookup Select Box variable.  

 

chrish5_0-1701120656794.png