The Unique ID with Context attribute solution is a Custom attribute that supports the creation of of unique ID values suitable for requirement IDs, etc., in a similar way to Identity attributes. It builds on the use of two custom attributes - one that defines the context and one that defines the ID. The result is an ID that is recognizable for users. This article describes how to create context values and set ID values. 


Prerequisites


Setting Context Values

To create a unique context for the ID series, select an item of a type that is configured to be a context. In the below example, an Architect has assigned the Unique ID Context attribute to the Design function item type so this attribute will display each time an item of that type is selected. 



Creating a unique context typically only needs to be done once, unless values need to be changed or new values need to be added. 

  1. To set the Context values, click the attribute editor button to access the Unique ID Context on xxx dialog. 
  2. Enter one or more context values to be used
  3. Click OK. The context values will be saved and available. 



Example: 


In the above example, "Comp1" and "Comp2" have been added. 

When a context is selected when setting a unique ID value, it will be prefixed to all ID values set in the series.


Setting Unique ID Values

Once a context value has been created, users can set ID values. 


Setting an ID value can only be done in the context of an item of the item type that has the Unique ID Context attribute. In our example above, the Design function item type has this context attribute. 



In the above example, if a user opens the "CruiseControlManager" Software component in a new tab without the Design function context, they will not be able to set a context ID.


  1. To set a unique context ID, select an item of the item type where the ID custom attribute is assigned.
  2. Click the New unique Id button. 
  3. Select a Context value in the Unique id dialog.
  4. Click OK. The unique context value will be set.


Result


Things to Consider

  • Each Unique ID Context counter starts at 1
  • Once a unique value has been set, it cannot be changed
  • If you delete an item with a unique value, the value cannot be reused 

  • If two or more Unique Id Context attribute values share the same value string, all unique IDs based on these will still be unique, sharing a common number series