Workflow "if" core activity with multiple conditions not working

Greg R_
Tera Contributor

I am developing a workflow that uses an "If" statement block with multiple conditions; each condition represents a checkbox variable, and the "checked" condition should return true, thus firing off its respective workflow. Unfortunately, I am having trouble getting this to work properly.

Currently, I have a "run script" pushing the values of each checkbox variable to the workflow.scratchpad in a string. Next, the workflow fires off from the "run script" to the "If" block, where each conditions looks to see if a value exists for its corresponding variable (ex.: String(workflow.scratchpad.trigger).indexOf("workersComp)!=-1). 

Unfortunately, the workflow will always simultaneously fire off the workflows for "promotion", "workers comp", "demotion", "paychange" and "termination", no matter which checkbox I select. What am I doing wrong? Any feedback is greatly appreciated. Thank you.

6 REPLIES 6

Allen Andreas
Administrator
Administrator

Hi,

Are you able to simply paste the screenshot of the if statement script in to your thread?

Not as 4 attachments?


Please consider marking my reply as Helpful and/or Accept Solution, if applicable. Thanks!

find_real_file.png

find_real_file.png

find_real_file.png

find_real_file.png

Multiple issues I can spot in the Workflow.

  •  Instead of if activity use Switch activity after run script activity.
  •  in the script correct the spellings of transfer in site_dept.transfere.
  •  put some logs inside script to check what value are we getting in the workflow.scractchpad.trigger. 

 

Please mark this correct & helpful if it answered your question.

 

Thanks & Regards,
Sharjeel

Regards,
Muhammad

Janel
Kilo Sage

I'm having a similar problem where one path is always followed.  I have 3 conditions on the IF activity with three different values (many_groups, one_group, and missing_approvers, all strings). 

The activity result when running the workflow always results in 'no', instead of the three things I have in the script.  I have included logs and the logs are showing the correct values that should be returned by the script.

Does anyone know if you cannot have more than "yes" or "no" for conditions on an IF activity now?