- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
06-29-2022 12:48 PM
Currently we use a reference qualifier to determine what fields are available in a reference field. I have not found where I can do the equivalent to an If statement for it. This filter works for every choice except one choice. If they pick that choice we do not want to filter at all. Any idea how to handle this?
Current reference qualifier: javascript: 'u_kemper_business_unit=' + current.variables.business_unit_aws+'^environment='+current.variables.environment_ref_aws;
Solved! Go to Solution.
- Labels:
-
Service Catalog
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
07-02-2022 11:53 AM
You can try this as your reference qualifier:
javascript:(function() { if (current.variables.business_unit_aws == 'DBA-misc') {return;} else { return ('u_kemper_business_unit=' + current.variables.business_unit_aws+'^environment='+current.variables.environment_ref_aws);} })();
By returning nothing for the DBA-misc statement it means we don't have anything for our reference qualifier, which is what you're looking for.
A Script Include could be used as well. The Script Include would be easer to read (the above is one giant line) and reusable.
I would probably just do the self-executing function myself if I wasn't needing to reuse it because what you are asking for is pretty straight forward. I would draw the line at having to do a GlideRecord lookup or something more complicated just because it's hard to read the code all on one line.
I have tested the above using other variables on a form in my instance. I have not tested it using current.variables though. I am assuming it would work, but that's the part I'll let you test. If it doesn't we can do it in a Script Include.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
07-05-2022 07:50 AM
Thank you!
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
07-01-2022 10:41 AM
I would appreciate any help you could give.

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
06-29-2022 01:19 PM
Hi,
Technically, you can use an if statement as using the "javascript:" prefix enables that field to accept JavaScript however, if it's a bit more complex, then yes, a Script Include may be better suited.
So use if statement though you'd use something like:
javascript:var query; if (current.variables.variable_name = 'x') { query="encodedQuery_here"; } else { query="encodedQuery2_here"; } query;
You can also use current.field_name if this doesn't involve variables. The above is an example. Hopefully you can take it from here?
Please mark reply as Helpful/Correct, if applicable. Thanks!
Please consider marking my reply as Helpful and/or Accept Solution, if applicable. Thanks!
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
07-01-2022 07:19 AM
Sorry I am not quite getting it in regards to how to get this written. I need it to work in such a way as "current.variables.business_unit_aws = DBA-misc" no filters get applied else the filter below gets applied.
Current reference qualifier:
javascript: 'u_kemper_business_unit=' + current.variables.business_unit_aws+'^environment='+current.variables.environment_ref_aws;

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
07-05-2022 11:14 AM
Hello,
I see you've found a correct answer. It was hopeful that displaying that you can in fact use if statements and the like, would help guide you all the way.
In any case, glad it's resolved.
If my reply above helped provide any guidance, please mark it as Helpful.
Thanks and take care! 🙂
Please consider marking my reply as Helpful and/or Accept Solution, if applicable. Thanks!