UIX V1 App - Create object from Command

Hi All,

I'm trying to create a UIX V1 app that creates an object using properties of the selected object, after the user selects the command from the right click menu.

I keep getting the following error.

CoScriptDelegate_Events.cpp, 418, Type mismatch (0x80040008)
IDispatchInvocation.cpp, 96, Type mismatch (0x80040008)
Create Client Follow Up from Renewal: main.js, 101, Type mismatch (0x80040008)
MErrorHelper.cpp, 2436, Type mismatch (0x80040008)
(M-Files 25.6.14925.4 2025-08-20T03:44:19.537Z)

line 101 is marked in the code below.

var propertyValues = new MFiles.PropertyValues();
var classValue = new MFiles.PropertyValue();
classValue.PropertyDef = 100;
classValue.TypedValue.SetValue(MFDatatypeLookup, 244);
propertyValues.Add(-1, classValue);

var titleValue = new MFiles.PropertyValue();
titleValue = new MFiles.PropertyValue();
titleValue.PropertyDef = 0;
titleValue.TypedValue.SetValue(MFDatatypeText, title);
propertyValues.Add(-1, titleValue);

var objectVersion = shellFrame.ShellUI.Vault.ObjectOperations.CreateNewObject(102, propertyValues); //Line 101

Class id 244 and object id 102 are definitely correct. title is just a string value. I've commented out all the other properties for now, as these are the only 2 required ones for this class.

Need a second set of eyes or someone with more UIX v1 experience to show me what I'm missing.