This discussion has been locked.
You can no longer post new replies to this discussion. If you have a question you can start a new discussion

SearchForPropertyEx doesn't actually return a NULL?

Dim propEffDate
Dim effDatePropDef

effDatePropDef = Vault.PropertyDefOperations.GetPropertyDefIDByAlias("M-Files.Property.EffectiveDate")

'Does the Object already have the Effective Date Property?
set propEffDate = PropertyValues.SearchForPropertyEx(effDatePropDef, true)

IF IsNULL(propEffDate) THEN
  Err.Raise 2, "NULL"
END IF
IF IsEmpty(propEffDate) THEN
  Err.Raise 3, "Empty"
END IF
IF IsObject(proEffDate) THEN
  IF proEffDate IS NOTHING THEN
    Err.Raise 5, "Nothing"
  END IF
  Err.Raise 4, "Object"
END IF

I am running this script in a State Action where I want to set the value of a Property. The Property may or may not be attached to the object so I am searching for the PropertyDef by Alias, then using this value to search the PropertyValues collection to see if the Property is included. However this Code triggers NONE of the Err.Raise (which I am just using to diagnose the behavior). I was expecting the IsNULL check to be true since that is what the documentation implies is the purpose of the SearchForPropertyEx call. But whatever is returned is neither NULL nor an Object so the code happily bypasses all these IF statements. What should I be expecting here.

Also, is there any way to perform logging from within a script? It is extremely difficult to observe what is happening.

-Jason