Name pattern validation

  • Release version: Australia
  • Updated July 20, 2026
  • 2 minutes to read
  • Summarize
    Summarized using AI
    This content was generated using new OpenAI-powered functionality. Results are provided on an as is basis and are not guaranteed to be accurate or complete.

    Summary of Name pattern validation

    Name pattern validation in ServiceNow's Australia release ensures that naming conventions for inventory templates are correct and consistent. Validation occurs twice: once at save time to prevent invalid patterns, and again when loading the Inventory Template Overview tab to check hierarchical template relationships.

    Show full answer Show less

    Save-time validation

    When creating or editing a name pattern in the Define name pattern modal, the system validates the pattern immediately:

    • Valid pattern: Displays a green message with a sample resolved name preview; the Apply button is enabled.
    • Invalid pattern or empty result: Shows a red error message and blocks the Apply action. Causes include invalid JavaScript, missing variables, or an empty string output.

    The pattern is only saved when you successfully apply a valid pattern and save the record. Closing without saving discards changes.

    Hierarchy render validation

    When the Inventory Template Overview tab loads, it runs registered validation providers against resolved names of sibling templates in the hierarchy:

    • Each provider checks siblings under the same parent at one tree level.
    • The default validation flags duplicate resolved names among siblings (e.g., two slots named "Slot -5").
    • Validation is scoped to siblings under the same parent and does not cross branches.
    • Customers can extend or replace the default duplicate-name check by registering custom validation providers.

    Handling multiple validation rules

    If multiple validation providers flag the same template:

    • The Overview tab shows a combined Validation failed banner listing all error messages separated by semicolons.
    • The tree node's error badge shows only one label, determined by the last provider that flagged the template.

    Unresolvable variables in patterns

    Patterns referencing variables that do not exist in a template’s context (e.g., a parent variable for a top-level slot) are shown with a ? substituted in the resolved name on the tree label. This indicates a variable mismatch for the template’s position.

    This substitution is purely visual and does not trigger error badges or validation failure banners.

    Practical benefits for ServiceNow customers

    • Ensures naming patterns are syntactically valid and produce meaningful names before saving.
    • Automatically detects naming conflicts among sibling templates to maintain unique and clear names.
    • Allows customization of validation rules to fit specific organizational naming standards.
    • Provides clear feedback on validation issues directly in the UI, helping users correct naming problems efficiently.
    • Visual indicators assist in identifying when name patterns reference inappropriate variables without causing validation failures.

    Name pattern validation runs twice: at save time to prevent errors, and when the Overview tab loads the hierarchy to catch issues specific to template relationships.

    Save-time validation
    Evaluates whether the pattern is a valid expression that produces a non-empty string.
    Hierarchy render validation
    Evaluates cross-template rules registered as validation providers — for example, duplicate names among siblings.

    Save-time validation

    When you create or edit a pattern in the Define name pattern modal, the modal validates the pattern before letting you apply it. Two outcomes are visible in the modal:

    • Pattern accepted: A green message appears beneath the input: Valid name pattern. Preview: <resolved name>. The resolved name in the preview is a sample evaluation. The Apply button is enabled.
    • Pattern invalid or produces an empty result: A red message appears: Name pattern results in empty name. Please try again. The Apply action is blocked. The same message appears if the pattern has invalid JavaScript, references a variable that does not exist, or produces an empty string when evaluated.

    The pattern is committed to the record only when you select Apply on a valid pattern and then save the underlying record. If you close the modal or close the record without saving, the pattern is not persisted.

    Hierarchy render validation

    When the Inventory Template Overview tab evaluates the hierarchy, registered validation providers run against the resolved names of related templates. Each provider evaluates siblings under a single parent at one tree level at a time and records validation results for any related template that fails its rule.

    The application includes a default duplicate-name check that flags two or more siblings whose patterns resolve to the same name. For example, if two slots at the same level both resolve to Slot -5, both slots are flagged. The check is scoped to direct siblings of the same parent and does not compare names across different branches.

    You can extend or replace this default check by registering additional validation providers. For more information, see Extension point for custom name validation.

    Multiple validation rules

    When multiple validation rules flag the same related template, the Overview tab combines their outputs:

    • The Validation failed banner concatenates the error descriptions from all providers that flagged the related template, separated by ; (semicolon and space). All errors are visible in one banner.
    • The Error badge on the tree shows only one label. When multiple providers each write a badge label, the badge displayed on the node is set by the last provider to flag the related template.

    The following banner shows output when a related template fails both a custom check and the default duplicate-name check.

    Validation failed: Slot name exceeds maximum length: Slot -4; Duplicate name at same level: Slot -4

    Unresolvable variables in resolved names

    Patterns can reference variables that have no value in a particular related template's context. For example, a top-level slot directly under an equipment template has no parent slot, so the variable parent_slot_name cannot be resolved for it.

    When the Inventory Template Overview encounters an unresolvable variable, it substitutes ? for the variable in the resolved name on the tree node label. The ? substitution is a signal that the pattern is using variables that do not fit the related template's position in the hierarchy.

    Note:
    The ? substitution does not raise an Error badge or a Validation failed banner. It is a display-only indicator in the tree node label.