Custom Label - String Replacement

Is there a way on a custom label where I can remove phrases in the string? For example I have an executive dashboard and one of the items says ‘Active Directory Topology Root’. I would like to have it say only ‘Active Directory’.

1 Like

You can easily remove certain parts of the label using replace. For example, the following would replace “Active Directory Topology Root” with “Active Directory”.

{{displayName.replace("Active Directory Topology Root", "Active Directory")}}

To remove it completely, just pass an empty string as the second parameter, e.g.

{{displayName.replace("Active Directory Topology Root", "")}}

Let me know if that works for you!

1 Like

Thank you! That worked perfectly!

What if you had multiple objects in a scope? What would be the syntax for changing 3 or 4 of the labels out of say 10 objects?

You can use if statements: https://goo.gl/VSregp