Thursday, August 31, 2017

Auto Scaling Image height in Salesforce Formula Fields

You can use Images is formulas, but if you want to scale them you have to specify height and width not useful if your images are going to be random aspect ratios!

So, simply replace the element you want to scale automatically with "-1".

This is a valid formula:

IMAGE( 'PATH_TO_IMAGE.PNG', 'The Alt Tag', -1, 200)
that image will always be 200px wide, and as high as it needs to be.