You can probably do this in the script.
You have to create some kind of lookup. You can look into this function:
If you want to do this using an extension, here's what you can try:
But keep in mind that the values you're using this extension with should match what you have in the DM.