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

[RESOLVED] Checking if specific PropertyValue is empty with VBScript

Former Member
Former Member
Hello! I'm new to both M-files and VBScript so bare with me here.
I wan't to check specific PropertyValue is empty with VBScript. I found sample code from user guide, but it doesn't specify where to get PropertyDef or PropertyValue.
Here's the example I'm talking about:

Option Explicit
Dim szPropertyName, szValue
szPropertyName = PropertyDef.Name
szValue = PropertyValue.GetValueAsUnlocalizedText
If Len( szValue ) < 10 Then
    Err.Raise MFScriptCancel, "The property """ & szPropertyName & """ must have a value of at least 10 characters."
End If


This is what I've been working with:

Option Explicit
Dim oProperty : Set oProperty = CreateObject("MFilesAPI.PropertyValue")
oProperty.PropertyDef = 1041
Dim oValue : Set oValue = CreateObject("MFilesAPI.PropertyValue")
oValue = PropertyValue.GetValueAsUnlocalizedText
If Len( oValue ) <= 0 Then
'Do stuff
End If


Running this script generates error Variable is undefined: 'PropertyValue' as expected, but how do I get the PropertyValue for specific property. Also how to check if it's empty?
Parents
  • Former Member
    Former Member
    Thank you tigu! This answers my question perfectly. I was overthinking and used workflows to trigger VBScript. Using automatic property validation is so much better for my need.
Reply
  • Former Member
    Former Member
    Thank you tigu! This answers my question perfectly. I was overthinking and used workflows to trigger VBScript. Using automatic property validation is so much better for my need.
Children
No Data