Using multi-select property in VBS

Hey guys, I was wondering if anybody could help me out on how to use the "TypedValue.GetValueAsLookups" function.
Here's an explanation on what I want to do.

I have a object called "Shipment", this object has these metadata:
Shipment ID (Integer)
Orders (Multi-select)

And then there's the "Order" object, with the following metadata:
Order ID (Integer)
Product (Text)
Planned shipment (Text)

What I want to do is fill out the metadata "Planned shipment" with the shipment ID everytime a user selects the order from the shipment metadata.
The customer needs this to keep track on which orders that is already has a planned shipment/planned to be shipped.

I have managed to do this with a single select property, but i have no idea how to set this up with a multi-select property.

  • So there can be multiple shipments on one order, and you want to add the IDs of each shipment to a text string that should have all the shipment IDs added as they get created?

    I wonder why you want the IDs in simple text property rather than a multiselect lookup property? The latter would give you the option to track additional properties such as dates on the shipments directly from the Order. You can configure Compliance Kit, Managed Properties to automatically add Shipments to the Order whenever a new Shipment is created.

    If you insist on using GetValueAsLookups you will get an array of Lookup items each of them having a number of properties as listed here https://www.m-files.com/api/documentation/#MFilesAPI~Lookup.html You would probably need the DisplayID (note that this is not necessarily the same as the M-Files ID!). You would have to loop through the array to get the DisplayID from each Lookup Item and add them one by one to a text string along with some delimiter to separate each value. Can be done be takes a little scripting! The next question probably is: how will you ensure that Planned Shipment automatically gets updated on Orders when a new Shipment object is created?

  • Its the opposite, one shipment can have multiple orders and each time a user chooses an order M-Files has to mark the order as "shipped". And that's where I want the shipment ID to be saved in the order metadata so users can see that the order is already registered in a shipment.

    I'm using the "TypedValue" function because I don't know better... If that's what you mean. The compliance kit is a paid addon isn't it? I will check that out, thanks!

    The example there in the documentation could help, I'll try that! 

  • The needed part of the Compliance Kit is free of charge. It is an package called Configuration Accelerators. You can download the Compliance Kit from https://catalog.m-files.com/shop/compliance-kit/ Make sure you also get the  Configuration Accelerators license 

    Search for "Compliance Kit" in https://kb.cloudvault.m-files.com to find the manuals.