Setup
...
How To
Using Folder Metadata in Activate with Custom Scripts and Expressions
9 min
prerequisites before following this guide, ensure your environment has shared folders configured these folders have been synchronized into activate via the folder sync process using custom scripts to read/write folder metadata sample script you can use a script type parameter in activate administrator to programmatically read and write metadata associated with folders here is a fully functional test script using system; using innovation activate; using innovation activate resources; class script scriptbase { public void main() { var folderresource = evaluator getobject(@"=//resources/folders/\\\myfilesharescantest\test folder 0001") as folderresource; if (folderresource is null) throw new exception("could not find folder"); logaudit($"{folderresource}"); var originalallmetadata = folderresource foldermetadata; logaudit($"original metadata is \r\n{originalallmetadata? formattedxml ?? "null"}"); var originaltestvalue = evaluator getstring(folderresource, "=/foldermetadata/testvalue"); logaudit($"original test value is {originaltestvalue}"); logaudit($""); xmlvalue x = new xmlvalue("folder"); x setvalue("testvalue", "my test value"); folderresource writefoldermetadata(x); var newallmetadata = folderresource foldermetadata; logaudit($"new metadata is \r\n{newallmetadata formattedxml}"); var newtestvalue = evaluator getstring(folderresource, "=/foldermetadata/testvalue"); logaudit($"new test value is {newtestvalue}"); } } what this script does finds a folder resource at a specific path inside activate logs the current metadata (if any) writes a new metadata element \<testvalue>my test value\</testvalue> logs the updated metadata output example test folder 0001 original metadata is null original test value is new metadata is \<?xml version="1 0" encoding="utf 16"?> \<folder id="7456" path="\\\myfilesharescantest\test folder 0001" when="2025 05 22t04 37 51" site="\[none]" server="myfilesharescantest"> \<testvalue>my test value\</testvalue> \</folder> new test value is my test value \ script complete 0 2 secs referencing folder metadata in activate expressions activate expression syntax once metadata is written, you can access it in activate using xpath style expressions in conditions, parameters, or other scripts example referencing the metadata \=/foldermetadata/testvalue this will resolve to my test value where you can use it parameters – e g , to auto fill a field based on folder metadata form logic – e g , hide/show elements conditionally scripts – e g , trigger actions or validations tips ensure the metadata node you reference exists to avoid null values you can validate or view metadata structure directly using the audit log output in scripts summary folder metadata enables powerful contextual workflows in activate you can read/write metadata using custom scripts use metadata values in activate expressions with xpath syntax