Sunday, 28 May 2023

Sitecore Content Hub: Finding Assets with Missing Renditions

 If you worked with Sitecore Content Hub, you must have worked with DAM module and in particular your worked with Renditions, if you don't know much about renditions I would suggest to go through my previous articles on it, just click here, In these previous posts I have explains renditions and how you can refresh renditions and how sometimes refresh rendition will be challenging, in this post I would like to provide some scripts samples of how you can find assets with missing renditions, keep reading! 



Imagine you would like a way to get a list of images with missing renditions, this could happen after you update the media processing set or specific flow, you may refresh renditions for assets through UI or through a mass edit job programmatically, some may fail, in any case, is there a way to get the Ids of assets of missing renditions? the answer is YES! keep reading. 

In the following script, I'm executing a query to get the media processing set / Media Matric that I would like to search my assets against, you can also see how I'm getting the renditions names that should be there when asset match this media processing set. 


Now once you have the flow(s) you're targeting, you can loop through the assets and get the assets with missing renditions, in the following script you can see I'm using an iterator to go through assets, then getting the file properties to get the extension and then compare with the right flow:  



Hope this helps someone, please do reach out through comments or email if you have comments or you need help/consultation. 

No comments:

Post a Comment