Skip to main content
13-Aquamarine
October 31, 2025
Solved

How do I know if an IMAGE property has a value?

  • October 31, 2025
  • 3 replies
  • 465 views

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

Best answer by nmutter

Try like this

let hasImage = me.imageProperty.length !== 0;

If no image is set the length should be 0

3 replies

nmutter16-PearlAnswer
16-Pearl
October 31, 2025

Try like this

let hasImage = me.imageProperty.length !== 0;

If no image is set the length should be 0

dbologna13-AquamarineAuthor
13-Aquamarine
November 4, 2025

HI All,

The solution proposed by mmutter works perfectly.

Many Thanks

BR

Dimitri

16-Pearl
November 3, 2025

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.

12-Amethyst
November 3, 2025

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