- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
05-19-2020 10:20 AM
Hello,
I have an "If" activity set up on a workflow that I cannot get to work. On my If activity is a "starts with" condition that I'd like to use to identify Select Box variable choices that start with certain text.
For example:
I have a Select Box variable on a catalog item that is named "Services". This Select Box contains the following choices:
- Services - Service Category 1 - Service Name 1
- Services - Service Category 1 - Service Name 2
- Services - Service Category 1 - Service Name 3
- Services - Service Category 1 - Service Name 4
Instead of adding an individual "IS" condition for each of these choices I would like to use the "starts with" condition to capture all of the services in Service Category 1. I set up the condition as follows:
Variables - My Catalog Item - Services - starts with - "Services - Service Category 1"
This condition is not working. What am I doing wrong?
Thanks,
Mike
Solved! Go to Solution.
- Labels:
-
Service Catalog
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
05-27-2020 11:42 AM
Hello all,
Apologies for the drop in communication. I was able to get this working using the Condition builder and the Value prefix of the Variable choices.
So in the Condition builder I entered:
Variables - My Catalog Item - Services - starts with - "services__service_category_1"
Thanks so much for all of the input, it's very much appreciated.
Mike

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
05-19-2020 02:02 PM
I just tried this with my PDI using the option with toString() in it and it worked fine. What type of variable is it?
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
05-19-2020 05:23 PM
It's a Select Box.

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
05-20-2020 07:50 AM
ok that is what I used. Are you looking at the Value of your select box or are you trying to use what the user sees? When scripting unless you use .getDisplayValue() it will use the value. Below is what I setup for my test variable. I made my text and value match. However if your does not you will need to use .getDisplayValue(). In the below screenshot I have put what current.variables.variablename returns in red rectangle.

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
05-19-2020 05:41 PM
try
answer = ifScript();
function ifScript() {
var sltbox = current.variables.yourvariablename.getDisplayValue();
if (sltbox.startsWith("Services - Service Category 1")) {
return 'yes';
}else{
return 'no';
}
}
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
05-27-2020 11:42 AM
Hello all,
Apologies for the drop in communication. I was able to get this working using the Condition builder and the Value prefix of the Variable choices.
So in the Condition builder I entered:
Variables - My Catalog Item - Services - starts with - "services__service_category_1"
Thanks so much for all of the input, it's very much appreciated.
Mike