Pre-Selected class dropdown

I am using the method ShowNewObjectWindow under ICommonFunctions interface. The idea is that the popup should have the class pre-selected as I would be passing it through

prefilledPropertyValues like below

const prefilledPropertyValues = [
{
PropertyDef: 100, // Built-in property for Class
TypedValue: {
DataType: 9, 
Lookup: {
Item: 14, 
DisplayValue: "Meeting Minutes"
}
}
}
];

objectCreationInfo is as below

const objectCreationInfo = {
title: config.Title || "Irfan title",
metadata_card_title: config.Title || "Irfan card title",
object_type: config.ObjectTypeId,
check_in_immediately_enabled: true,
disallow_template_selection: true

};

Showing the window as below

const resultFromCreationWindow = await (MFiles as any).ShowNewObjectWindow(
config.ObjectTypeId,
objectCreationInfo,
prefilledPropertyValues,
[]
);

but it always shows where i need to select the class manually despite i have already provided the class code. I don't mind if dropdown is not shown and it is plain Pre-filled Input Text if things don't work this way a pre-selected dropdown will also help here but not that I have to select it manually.

 it is always with this dropdown and looks like it didn't respect my input values as 14 as the class ID

Technically, it seems like lazily loading on click and not as something ready upfront. 

Need your support in achieving it. 

  • I think I ran into this exact issue. I believe there is a bug related to showing the name of preselected value list items, but if you explicitly pass the name of your lookup it will show correctly. See community.m-files.com/.../32852

    function makePropertyValue_VLILookup(pd_id, vl_id, item_id, label) {
    	let pv = makePropertyValue(pd_id, MFiles.VaultEnums.Datatype.DATATYPE_LOOKUP);
    	pv.value.data.lookup = {
    		value_list_item_info: {
    			obj_id: {
    				type: vl_id, 
    				item_id: {
    					internal_id: item_id,
    					external_repository_id: {}
    				}
    			},
    			name: label, // This should be optional, but there is a bug (CAT-223) - https://community.m-files.com/groups-1602070992/developers/f/developer-forum/10959/uixv2---shownewobjectwindow---prefilledpropertyvalues/32852
    			options: {
    				all: false
    			}
    		},
    		version: {
    			type: MFiles.VaultEnums.ObjVerVersionType.OBJ_VER_VERSION_TYPE_VALUE_LIST_ITEM
    		}
    	};
    	return pv;
    }
    function makePropertyValue(pd_id, datatype) {
    	return {
            property_def: pd_id,
            value:  {
                type: datatype,
                is_null_value: false,
                data: {}
            }
        }
    }