Ever found yourself needing to add a reference qualifier to an assessment metric with a data type of “Reference”?
If you answered yes to the above, then you’ll know what a pain it is to do this as it involves creating a query business rule that only executes when the “sysparm_target” URL parameter value contains “ASMTQUESTION”. Not only was this a pain, but also not very scalable as it’s not possible to have different qualifiers for different assessments. It also didn’t work at all if you were completing the assessment via the Service Portal due to the <sn-record-picker>’s unique way of querying data from the database (it uses the angular.do processor if you’re wondering).
There’s a better way
The Assessment Metric [asmt_metric] table already contains a field called “Condition”. Look as hard as you like, you won’t find it on the form. You’ll also not find it documented anywhere on the ServiceNow docs site. I’m here to give you the good news that this field works, there’s even a UI Policy that hides and shows it based on selecting “Reference” as the “Data type” of a metric. I cannot think of a reason why ServiceNow have chosen not to include this on the form. Is it a bug? Does it cause a bug? (not in my testing). This solution works in both the Service Portal and Core UI assessment Interfaces and I’ve not seen anything untoward since enabling it.
I’d recommend you add the field into the last section of the form. See screenshot.
Let’s take it for a spin!
Great, now we’ve added the “Condition” field to the Assessment Metric form, we can start configuring metrics with it.
Now that we’ve added a condition into our Assessment Metric, we can test it out.
As expected, we are presented with just the user record of Abel Tuter, so it’s working as designed.
I hope that has helped you to easily configure a reference qualifier for a reference type Assessment Metric, or at the very least provided you an option to remove an unneeded query business rule.