Is it possible to use an if/else in a reference qualifier?

Erik Nelson
Kilo Sage

I have a list collecter variable that currently is set to only display members of a selected assignment group.  This is great as long as the group is in ServiceNow.  Part of the build is for items that won't be an assignment group, but still uses the user lookup.

Can something be setup in the Reference Qualifier to the effect of "javascript:if(current.variables.var1=X no filtering);else(Group_member(current.variables.var2):

If that's not possible, should it be looking to client script, or similar to do the work?

Thanks!

Erik

1 ACCEPTED SOLUTION

Michael Ritchie
ServiceNow Employee
ServiceNow Employee

script includes aren't necessary... Yes is it possible and there are many out of the box fields with them.  I have learned best by looking at out of the box examples over the last many years.  Navigate to System Definition \ dictionary and search where reference qual contain "if" for many examples.

View solution in original post

9 REPLIES 9

Elijah Aromola
Mega Sage

You should create a script include and call it from your reference qualifier. 

javascript: new ScriptIncludeName().functionName()

Michael Ritchie
ServiceNow Employee
ServiceNow Employee

script includes aren't necessary... Yes is it possible and there are many out of the box fields with them.  I have learned best by looking at out of the box examples over the last many years.  Navigate to System Definition \ dictionary and search where reference qual contain "if" for many examples.

Hello Michael

Do you know whether its possible to add an 'if/else if' in a reference qual? I have the 'if/else' working, however it seems to fail when i add additional conditions.

Steve

Yes, I don't see any out of the box examples to point you to, but if your reference qualifier has the "javascript:" prefix, everything past it is evaluated.