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

Help with VBScript to Create Document in Event Handler

Former Member
Former Member
Hi All,

I have search the forum and have managed to covert VB to VBScript but i still cant get the following to work. I am being held up on the final line of code which creates the object with a Type Mismatch Error.

Can someone please help.

here is my code;

Option Explicit

Dim oClass: Set oClass = CreateObject("MFilesAPI.PropertyValue")
Dim oName: Set oName = CreateObject("MFilesAPI.PropertyValue")
Dim oPropValsNew: Set oPropValsNew = CreateObject("MFilesAPI.PropertyValues")

'Set Name
oName.PropertyDef = MFBuiltInPropertyDefNameOrTitle
oName.TypedValue.SetValue MFDatatypeText, "Test"
oPropValsNew.Add -1, oName

'Set Class
oClass.PropertyDef = MFBuiltInPropertyDefClass
oClass.TypedValue.SetValue MFDatatypeLookup, 0
oPropValsNew.Add -1, oClass

vault.ObjectOperations.CreateNewObject 0, oPropValsNew


Parents
  • Former Member
    Former Member
    Got it all work ok now.

    As I only want this to happen on a particular document class i just got it to check before running script which creates an alternative document class.

    I will Post the final code once complete.
Reply
  • Former Member
    Former Member
    Got it all work ok now.

    As I only want this to happen on a particular document class i just got it to check before running script which creates an alternative document class.

    I will Post the final code once complete.
Children
No Data