In workflow, check if property has more than 1 entry

I'm creating a workflow.  The first two states are Draft and Reviewer(s).  The Reviewer(s) property is multi-select.  I require the user of the workflow to enter at least two Reviewer(s).   I set the property pre-condition to check if Reviewer(s) > 1.  However, this doesn't seem to work.  I guess the ">" operator is used for numbers only, and not quantity.

Is there a way to accomplish this without creating two different properties?

Parents Reply Children
  • Something like this could work, please test before applying to a production environment:

    Option Explicit
    
    ' Get the property by its alias.
    Dim iPDProperty : iPDProperty = GetPropertyIDByAlias("PD.Reviewers")
    
    ' Get the collection of property values, this is where you'll find the field.
    Dim PropertyValues : Set PropertyValues = Vault.ObjectPropertyOperations.GetProperties(ObjVer, False)
    
    ' Does the property exist on the metadata card?
    If PropertyValues.IndexOf(iPDProperty) <> -1 Then
    	' Property exists on the metadata card.  Good to go.
    
    	Dim propertyValue : Set propertyValue = PropertyValues.SearchForProperty(iPDProperty)
    	If (propertyValue.TypedValue.GetValueAsLookups.Count < 2) Then 
    		Err.Raise MFScriptCancel, "At least two reviewers required"
    	End If
    Else
    	Err.Raise MFScriptCancel, "Reviewers not found"
    End If
    
    '##### Common Functions #####
    Function GetPropertyIDByAlias(alias)
    	Dim iID
    	iID = Vault.PropertyDefOperations.GetPropertyDefIDByAlias(alias)
    	If iID = -1 Then
    		Err.Raise MFScriptCancel, "Property Definition not found in vault by specified alias of '" & alias & "'"
    	End If
    	GetPropertyIDByAlias = iID
    End Function