How to check if a custom property exist?

(imported topic written by TheCaptain)

Hi,

When I perform the test below on a TEM server that has never been configured with the custom property “Manufacturer”, I receive the message “Error: Singular expression refers to nonexistent object”.

((if (exists values of (results from (bes property “Manufacturer”) of it)) then values of (results from (bes property “Manufacturer”) of it) else “UNKNOWN”) ) of bes computers

Is there alternative query that would catch this condition?

Thanks,

Rob

(imported comment written by dmccalla)

A simple if/then/else statement will allow you to trap the error and deliver a more meaningful message. For example…

if (exists bes property whose (name of it = “Manufacturer”)) then (values of results from (bes property whose (name of it = “Manufacturer”)) of bes computers) else (“Property Does Not Exist”)

(imported comment written by TheCaptain)

Hi,

Yes, I am able to use this approach. It works great.

Thanks,

Rob