How to refer to items in a value list by their 'Name'

Hi, I've got some code in a workflow where depending on one source property, we're setting another destination property 'Type'

'Type' is a value list which contains:

Programme, ID = 1

Project, ID = 2


Previously I was doing that via just setting the ID number. I know that Project is ID=2 in the Type value list, so I have that ID number hard coded in the script

However, the vault is due to be deployed to production via content replication rather than transferring an .MFB so we've been told that all ID number references should be avoided and everything needs to use aliases instead, as the ID numbers may get shuffled around in the transition and won't stay in the same order


So, How can I avoid using the ID? I know the value in the source property will be 'Project', so do I have to construct a search to find the item within the value list that matches, then I can get the (new) ID number, and use that ID as previously? or is there some better approach

Many thanks

Parents Reply Children
  • Great, thanks for the info. I'd appreciate confirmation on the GUID idea because we can't currently test this ourselves

    Another approach might be to have 1x Managed Property rule for each different value, and set a static value (choose from list) to each different one?

    Those rules you select from the value list items like a dropdown so you see the name. i think it stores it as a GUID tho in the JSON

  • In general when you configure a vault application (like managed properties), you can choose how the reference is made.  I don't recall exactly, but I think it will default to the GUID (the second dropdown to the right of the property name allows you to choose between GUID and ID).  It's reasons like that which lead me to believe that I am correct about the GUIDs.

    Unfortunately self-doubt has now crept in, so I need to get someone else to confirm...! Joy

    I have put a message on an internal product teams channel.  I'll update the thread when I get a response (probably tomorrow).

  • Heheh yea it defaults to GUID and the other option is something like 263-3, which is valuelistID-valuelistItemID

    If there was aliases available, could have selected those as well. but value list items can't have aliases, which is what makes this all such a pain

    I'm also assuming GUIDs don't change, otherwise it'll break a lot of our Compliance Kit config and we'd have been advised to update that as well

  • I just did a quick replication package export of a value list and items from one vault to another.  The IDs stayed the same.  Below is a screenshot showing the snip I took of the source vault, and the data from the target vault after import:

    So, yes, use the GUIDs.

  • Many thanks
    Does your test retain those IDs because they're nicely alphabetalical with no gaps etc?

  • I don't think that makes one bit of difference.

    That said: if you have a local M-Files vault with the exact list you want to use, you could create a replication package containing just that list and its values, export it, and then import it into a blank vault for testing.  That's exactly what I did, but you could test it with your exact structure if you have concerns.

    Edit: having read the response from , then having re-read your post, I realise that I misread it.  As he said said: the IDs happen to be the same in this case, but may not be in yours.  You need to assume that they will be different even though in some cases - especially when replicating into a blank vault - they may happen to end up the same.

  • The ID numbers will change in replication if someone manually adds an item in the receiving vault. This new item will automatically take the next ID available. This ID will then be taken when replication pulls in a new item from the external vault, and the incoming item will have to change ID to the next available number.