How to create a Switch Statement in the workflow that acts on a custom field across all ordered Catalog items.

willkara
Kilo Contributor

So we have a number of Catalog items that are order-able. They can range from Windows/Linux servers to database servers ...etc.

We've successfully created them in the catalog and are starting to create their forms and create the workflow for them. I was hoping to have a single workflow for all of the items that follows a single idea. Please see the image below.

WorkflowIdea.png

Each catalog item has a field that is hard-coded into it, a Service Identifier. We don't have it as a choice field or anything like that, just a simple Text field that we set a default value into and make it ReadOnly.

I'd like to create a Switch/Case statement that allows me to put in a condition for each separate identifier. I'm able to create the Switch statement now, but it makes me select a Service Identifier field on a specific Catalog Item.

serviceIden.PNG

Is there a way to make it possible to select the Service Identifier field from EACH item and create the Switch/Case statement for that? I could simply add a condition on the Switch/Case but I'm still left with the Always action. Something like this:

switch serviceIdentifier:

        case "this one":

                  do blah;

        case "that one"

                  do blah2;

- Will

It's not an Out-Of-The-Box field. It's a field that we have put in ourselves. Message was edited by: William Karavites

1 ACCEPTED SOLUTION

Ok, so if your user is to have no interaction with this field, then why make it a variable in the first place?
Why not just do evaluations in the workflow that ask what Catalog Item it is and branch logic from there (using IFs or Runscript)


View solution in original post

11 REPLIES 11

Uncle Rob
Kilo Patron

The following two doc links should help:


Switch workflow activity


Activity result value


I took a look at those and when it has me select a Variable, it makes me select one for a single catalog item. Not the field in general, see the above image. I need to be able to have a switch/case statement on the variable across all items. Not just for an instance of that variable in a single item.



Even when I select one of those variables, it can't auto-fill it with the choices because it doesn't come from a Choice list, just a text box that we put a value into. That also forces it to have an Always action which I wouldn't need to use.


So you have a variable that appears on each of these Catalog Items.   Is it the same variable (as in, present via variable set), or just named the same?


It's not currently in a variable set, but we could put it into one.