10 Replies · Latest reply on Jan 2, 2018 3:52 AM by Huma Naaz

    Switch Activity Evaluates True on Multiple Cases

      I'll attach a picture of a snippet of my workflow at the end of this for reference.

       

      I've got a switch statement that evaluates the model category of a hardware asset. The pseudocode is as follows:

       

      switch(model.cmdb_model_category)

      {

           case contains('Printer')

                Set scratchpad.catalog_category = 'Printers';

                break;

           case contains('Monitor')

                Set scratchpad.catalog_category = 'Monitors';

                break;

      case contains('Computer Peripheral')

                Set scratchpad.catalog_category = 'Peripherals';

                break;

      }

       

      Problem I'm getting is when the model category is a "Printer" and a "Computer Peripheral". Both case 1 and case 3 evaluate true and my scratchpad.catalog_category is set to Peripherals, when if it were a Java switch like the wiki suggests, it would evaluate to "printers" first and break out of the switch.

       

      SwitchIssue.PNG