Define a JavaScript expression to control how configuration items (CIs) are named when they are created from a related template. Naming patterns can include literal text, token library variables, conditionals, and string
transformations.
Before you begin
Role required: inventory_template_manager.
Procedure
-
Navigate to the SOW workspace or the Network Inventory workspace.
Go to and select the inventory template that contains the related template you want to update.
-
Open the related template record.
From the inventory template, select the Related Templates tab. Locate the related template you want to update and select its name to open the record.
Alternatively, select the Overview tab and select the related template's node in the tree. Select View details to open the related template record in a new tab.
-
Open the name pattern editor for the related template.
On the related template record's form, locate the Name Pattern field. Select the Define name pattern button at the right edge of the field.
The Define name pattern modal opens. The modal shows the current pattern, if one exists, in the Name pattern input.
Note: The Define name pattern button is visible only to users with the Inventory Template Manager role. Users without this role see the Name Pattern field as read-only.
-
Edit the pattern in the Name pattern input.
Enter or update the JavaScript expression that produces the CI name. The pattern can combine literal text, variables, string methods such as .replace(), and conditional logic using the ternary operator.
For the full pattern syntax, see Inventory template name generation.
- Optional:
Insert a variable from the token library.
Place the cursor in the Name pattern input. The list of available variables opens automatically. Select a variable from the list to insert it into the pattern at your cursor position.
-
Review the inline pattern feedback.
As you edit the pattern, the modal displays inline feedback below the Name pattern input:
- Pattern valid
- A green message appears: Valid name pattern. Preview: <resolved name>. The name shown after Preview: is a sample of what your pattern produces, using sample
values for the pattern's variables.
- Pattern invalid or empty result
- A red message appears: Name pattern results in empty name. Please try again. The Apply action is blocked. The same message appears whether the pattern has invalid
JavaScript, references a variable that is not in the token library, or evaluates to an empty string.
- Optional:
Select Preview to refresh the inline feedback.
Selecting Preview re-runs the pattern and updates the sample name shown in the green message.
-
Select Apply to add the pattern to the Name Pattern field.
The modal closes, the Name Pattern field shows the new pattern, and the record form indicates you have unsaved changes.
Note: Apply does not save the record. The pattern stays in the form until you save the record.
-
Save the related template record.
What to do next
To confirm the pattern produces the expected resolved name, open the parent inventory template, select the Overview tab, and select Refresh. The tree updates to show the resolved names.
For more information, see Inventory template hierarchy view.