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

Setting MultiSelect Property Definitions via VB Script

I am setting the properties of a related document during workflow - so that any changes reflected to my current document are updated in the related document as well. I am essentially updating an already existing clone of my current document so they match one another.

This code works perfectly using my current method for all property definition types except when the property definition is a Multi-Select list.

The method I am using for the other datatypes is as follows:

       
'Set Property 1038
oPropertyValue.PropertyDef = 1038
oPropertyValue.TypedValue.SetValue MFilesAPI.MFDataType.MFDataTypeLookup,
                        oProps.SearchForProperty(1038).TypedValue.GetLookupID()
Vault.ObjectPropertyOperations.SetProperty oCheckedOutVersion.ObjVer, oPropertyValue



Does anyone have any suggestions on how to amend this code to suit the property definition of a multiselect data type?
Do I need to put the values that exist into a collection and then call on that collection to set / update them in the related document?
Parents
  • Not sue if the answer is still relevant, but I was looking for the same answer and here is what I found worked for me.
    Based on the post community.m-files.com/index.php

    Multiselect property needs to use Lookups, with the S on the end.
    Wehen setting the multiselect property instda of using SetValue command, SetValueToMultiSelectLookup command is needed.

    The code is something like this.

    'First get the values from existing document and store them in a variable

    CONST iProp1038 = 1038
    dim Prop1038': Prop1038 = PropertyValues.SearchForPropertyEx(iProp1038, true)
    dim Prop1038Lookup: set Prop1038Lookup = PDAssetNoPV.Value.GetValueAsLookups() 'Note that there are 2 similar commands for singel and multi select lists, for multiselect it is nessesary to use Lookups with S on the end.


    'Set the property in new object

    oPropertyValue.PropertyDef = 1038
    oPropertyValue.Value.SetValueToMultiSelectLookup Prop1038Lookup
    Vault.ObjectPropertyOperations.SetProperty oCheckedOutVersion.ObjVer, oPropertyValue
Reply
  • Not sue if the answer is still relevant, but I was looking for the same answer and here is what I found worked for me.
    Based on the post community.m-files.com/index.php

    Multiselect property needs to use Lookups, with the S on the end.
    Wehen setting the multiselect property instda of using SetValue command, SetValueToMultiSelectLookup command is needed.

    The code is something like this.

    'First get the values from existing document and store them in a variable

    CONST iProp1038 = 1038
    dim Prop1038': Prop1038 = PropertyValues.SearchForPropertyEx(iProp1038, true)
    dim Prop1038Lookup: set Prop1038Lookup = PDAssetNoPV.Value.GetValueAsLookups() 'Note that there are 2 similar commands for singel and multi select lists, for multiselect it is nessesary to use Lookups with S on the end.


    'Set the property in new object

    oPropertyValue.PropertyDef = 1038
    oPropertyValue.Value.SetValueToMultiSelectLookup Prop1038Lookup
    Vault.ObjectPropertyOperations.SetProperty oCheckedOutVersion.ObjVer, oPropertyValue
Children
No Data