I am trying to save time by running a script to change tags by enabling history and set a database. I am unable to figure out how to set the database.
def enable_history_for_folder(base_path):
tags = system.tag.browse(base_path)
database = "SFISQL04_MSSQL"
for tag in tags:
full_path = base_path + "/" + tag['name']
if tag['hasChildren']:
# Recurse into subfolders
enable_history_for_folder(full_path)
else:
try:
# Get tag configuration
config = system.tag.getConfiguration(full_path, True)[0]
# Set history properties
config["HistoryEnabled"] = True
config["StorageProvider"] = database # Replace with your actual history provider name
# Write the new config
system.tag.configure(base_path, [config], "m")
print("Enabled history for:", full_path)
except Exception as e:
print("Failed to update:", full_path, "| Error:", e)