How can I check from JavaScript whether the content of an image property has a value or the default value 'image not available'?
BR
Dimitri
Solved! Go to Solution.
Try like this
let hasImage = me.imageProperty.length !== 0;
If no image is set the length should be 0
Try like this
let hasImage = me.imageProperty.length !== 0;
If no image is set the length should be 0
HI All,
The solution proposed by mmutter works perfectly.
Many Thanks
BR
Dimitri
I would check if an IMAGE property has a valid value is to ensure it’s both defined and not empty. You can use something like this:
let hasImage = me.imageProperty && me.imageProperty.trim().length > 0 && me.imageProperty !== "image not available";
This covers:
the property being undefined or null,
empty strings, and
default placeholders like "image not available".
I dont think that there is a default value 'image not available'. you would get 0 length if an image is not set.
If you’re using this check in a mashup or service logic, it ensures the image field is actually populated with a valid URL or base64 image data before you proceed.
Hi @dbologna,
I wanted to follow up with you on your post to see if your question has been answered.
If so, please mark the appropriate reply as the Accepted Solution for the benefit of other members who may have the same question.
Of course, if you have more to share on your issue, please let the Community know so that we can continue to support.
Thanks,
Abhi

