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

Set Automatic Value For Date?

Former Member
Former Member
Hi Everyone,

My Question is very simple ;

I have a propery field called = "Document Date" is it possible to set its value to something like "DateAndTime.Now" by a VBScript?.
Parents
  • Former Member
    Former Member
    Search for "MFDatatypeDate" in the APi help.

    This should get you started:

    [...]
    ' Create new property value.
    Dim oPropertyValue As MFilesAPI.PropertyValue = New MFilesAPI.PropertyValue
    oPropertyValue.PropertyDef = 1096 ' In this case, represents the "Effective through" property
    oPropertyValue.TypedValue.SetValue(MFilesAPI.MFDataType.MFDatatypeDate, DateSerial(2015, 1, 1))

    ' Modify the object. The object needs to be in checked out state.
    oVault.ObjectPropertyOperations.SetProperty(oObjectVersionAndProperties.ObjVer, oPropertyValue)

    Of course you will need to adjust it a bit. I believe the vb function to get the current time is "now()" or something similar.
Reply
  • Former Member
    Former Member
    Search for "MFDatatypeDate" in the APi help.

    This should get you started:

    [...]
    ' Create new property value.
    Dim oPropertyValue As MFilesAPI.PropertyValue = New MFilesAPI.PropertyValue
    oPropertyValue.PropertyDef = 1096 ' In this case, represents the "Effective through" property
    oPropertyValue.TypedValue.SetValue(MFilesAPI.MFDataType.MFDatatypeDate, DateSerial(2015, 1, 1))

    ' Modify the object. The object needs to be in checked out state.
    oVault.ObjectPropertyOperations.SetProperty(oObjectVersionAndProperties.ObjVer, oPropertyValue)

    Of course you will need to adjust it a bit. I believe the vb function to get the current time is "now()" or something similar.
Children
No Data