Tag Policy that checks if a specific Key has one of a few Values.

Adam Geil
Kilo Sage

I'm attempting to setup Tag Governance, and I'm trying to configure a Tag Policy that checks if a specific Key has one of a few values. Example: The Key would be businessUnit, and the acceptable values would could be Finance, IT, HR, or Procurement. I believe this has to be scripted, but I'm not positive. Does any have any experience with this or an example script of how to make this policy work?

1 REPLY 1

Ram Devanathan1
ServiceNow Employee
ServiceNow Employee

hi yes you need to use scripted type checks.

there's example code that gets presented - just modify it for your values.

// The script should return a string set to tagValues variable.
// your code
// tagValues = ['value1', 'value2']
 

if you need to look up the values against a table, you can run a glide-query, get the results into an array of unique values and assign it to the tagValues in the script.

 

e.g.

var tagValues = [];
tagValues = ['value2-a','value2-b'];