The problem
Create public links for a specific rendition of all assets except for when a document is created or uploaded.
The brain
All assets have file properties that are part of the system OOTB metadata.
I know a trigger on asset change and action that runs a script is the easiest way to get this done. We could add conditions on a trigger to check the asset type relation and then run a script to create a public link. if all else fails look at a custom solution.
The struggle
Trying to load an asset and its related media and types is a little icky. You can read the entity and try to find the type. If it’s an image, video, or document one can decide to run different tasks. FileType, fileName, and File Property metadata all are accessible but a little convoluted to get and check. So I picked a GUI path and just check the asset file property on the trigger condition. so the trigger won’t even fire let alone check inside the script for a valid scenario.
This was a simple solution, but the only problem was finding an example of how to read JSON values in conditions. Thus I gave birth to this blog post. Just type in property names in the path field and trigger works as expected.
Related links to click if you need to.
https://doc.sitecore.com/ch/en/users/34/content-hub/manage–ootb-schema.html
https://www.sitecored.com/2021/09/sitecore-content-hub-automatically-assign-asset-type.html
~ Do not overdo it. If you can, you will do it. If you can’t, someone else will do it. ~