Future-proofing Session Relevance Code

(imported topic written by Ivan.FPL)

Is there a recommended format to writing future-proof session relevance code so that in the case of an update, the code continues to work without problems? This is now the third time that an automatic MDM update has broken my session relevance code that runs in my scripts. The following is an example of what I’m referring to:

(id of it) of bes computers whose (value of (results from (bes property whose (name of it = “OS”)) of it) contains “iOS”)

The above code ceased to work last night at 8:30pm ET because of the new “OS” property in “Enterproid” that was introduced with the MDM 2.2 update. After about 30 minutes of trying different pieces of code and looking through the Session Inspectors document, I found the syntax that would help specify the property I wanted to use:

(id of it) of bes computers whose (value of (results from (bes property whose (name of it = "OS"
AND reserved flag of it
)) of it) contains “iOS”)

So besides “name of it” and “source analysis of it” and now “reserved flag of it”, what are other recommended properties of the object I’m checking against to make sure that this does not occur again?

(imported comment written by jeremylam)

What you have is fine, since there should only be one reserved property with that name.

If you want to be extremely specific, you can specify the property exactly using its id.

You can determine a property’s id (a tuple of three integers) with the following session relevance:

(id of it, name of it) of bes properties whose (name of it = “OS”)

This will give you something similar to:

( 2299640212, 5, 1 ), OS

So you can specific that property exactly with:

bes property whose (id of it = ( 2299640212, 1011, 1 ))