How to Convert a Comma-Separated List of Country Names into a list of IDs

Need Help Mapping Country Names to IDs for Vincere Multi-Select Field

I’m trying to build a scenario in Make that sends selected countries to a custom multi-select field in Vincere. The countries come in as a comma-separated string, for example:

Finland, Sweden, Switzerland

I need to convert each country name into a numeric ID, like:

  • Finland → 16
  • Sweden → 25
  • Switzerland → 26
  • etc.

Then I want to send them to Vincere using this structure:

“field_values”: [16, 25, 26]


What I’ve Tried:

I’ve used map() like this:

{{map(split(“Finland, Sweden, Switzerland”; “,”); :country; switch(trim(country); “Finland”; 16; “Sweden”; 25; “Switzerland”; 26; null))}}

But I keep getting this error:

Failed to map ‘0.value’: Function ‘map’ finished with error! ‘{empty}’ is not a valid key.

I’ve tried adding/removing the colon, switching variable names, and even using hardcoded switch blocks like:

[{{switch(…)}}, {{switch(…)}}, {{switch(…)}}]

That works, but it’s not scalable or dynamic.


My Goal:

  1. Split a list of countries from a string
  2. Convert each country name into its ID
  3. Return an array of numbers like [16, 25, 26]
  4. Pass that array into Vincere’s multi-select field (field_values)

Has anyone done this before or have a workaround that works dynamically inside Make?

Thanks in advance!

Here are the countries and the IDs I want to map them to:

  1. South Africa → 1
  2. China → 2
  3. Dubai → 3
  4. Hong Kong → 4
  5. Indonesia → 5
  6. Japan → 6
  7. Malaysia → 7
  8. Singapore → 8
  9. South Korea → 9
  10. Thailand → 10
  11. Vietnam → 11
  12. Austria → 12
  13. Belgium → 13
  14. Czech Republic → 14
  15. Denmark → 15
  16. Finland → 16
  17. France → 17
  18. Germany → 18
  19. Ireland → 19
  20. Italy → 20
  21. Malta → 21
  22. Norway → 22
  23. Portugal → 23
  24. Spain → 24
  25. Sweden → 25
  26. Switzerland → 26
  27. The Netherlands → 27
  28. United Kingdom → 28
  29. Australia → 29
  30. New Zealand → 30
  31. USA → 31
  32. Canada → 32
  33. Antilles → 33
  34. Argentina → 34
  35. Brazil → 35
  36. Costa Rica → 36
  37. Mexico → 37

Hi @Zlatan

We could first create an array for the list of countries with ID using parse JSON:

Then iterate the country name:

Aggregate using a text aggregator:

Finally to get an array of IDs:

This is the obtained output:

2 Likes

Thank you @Shornalatha it works perfectly!!

2 Likes