Suggestions around maintaining Key Values

Bommera
Tera Contributor

Hi Community,

 

Does anyone have any suggestions on maintaining data in Key Values ( cmdb_key_value ) table? We have many sources in our environment that create data in this table and the updated field value of the record doesn't change with every discovery schedule unless there is a change in the incoming value. So we are unable to know whether a key value pair is valid or not.  I could create a new date field and start updating it every time but that doesn't seem like a good idea. Really appreciate any suggestions on this that doesn't need much customization. 

4 REPLIES 4

Community Alums
Not applicable

Hi @Bommera ,

 

Here are some suggestions on maintaining data in the Key Values (cmdb_key_value) table in ServiceNow:

  1. Use a naming convention for your key-value pairs. This will help you to identify and track the different key-value pairs in your environment. For example, you could use a naming convention that includes the name of the source that created the key-value pair, the type of key-value pair, and the date the key-value pair was created.
  2. Set a default value for the updated field. This will ensure that the updated field is always updated, even if the incoming value does not change. For example, you could set the default value to the current date and time.
  3. Create a script that runs on a regular basis to check the validity of the key-value pairs in the table. This script could check for the following:
    1. Whether the key-value pair still exists in the source system.
    2. Whether the value of the key-value pair has changed since it was last updated.
    3. Whether the key-value pair is still relevant to the configuration item.
  4. Use a custom discovery rule to filter out invalid key-value pairs. This rule could check the validity of the key-value pair in the separate table and only create a record in the cmdb_key_value table if the pair is valid. This would prevent invalid key-value pairs from being created in the cmdb_key_value table in the first place.

Let me know which one suits you better:)

If this helped you in any way, please hit the like button/mark it helpful. So it will help others to get the correct solution.

 

regards,

Prasad

Thanks a lot @Community Alums for the suggestions. I will set the default value of the updated field and will check how that goes.

Hi @Bommera Are you able to use the default value on Updated field? We attempted this approach but does not seem to work as expected. Want to understand how you approached this.

Sandeep132
Kilo Sage

Hi @Bommera  Since Key Value table has reference to Configuration Item, you can dot walk into "Most Recent Discovery" field on the Configuration item record to know if the Key Value is still valid.