Mendix version 9.10.1 In a project I'm receiving a string out of a JSON. I want to use this string to select an existing enumeration. This currently fails. I've seen some questions about it on the forum, but none of the solutions offered give a different reaction. The topics that didn't work for me are as follows: https://community.mendix.com/link/questions/102428 https://community.mendix.com/link/questions/106448 And as a bonus: https://medium.com/mendix/customizing-java-actions-mendix-25ec5cc14f24, https://docs.mendix.com/refguide/enumerations Their solution is to change the EnumerationFromString and simply imput the exact key. See below my test: One enum as example: The copied and edited EnumerationFromString: The microflow I'm triggering with a button as a test: This now constitutes a test instead of a JSON, so I'm creating a String as a variable to put in. This comes from the key of the enumeration (though it has also been done with the caption, both via the enumeration or by writing it by hand): The call to JAVA action: This gives the following errors (not everything is shown as I think this is the error that occurs with not sending a string identical to an enumeration): And the following as well: Does anyone know why my current solution isn't working? To my knowledge it is identical to the other answers, yet the error message is always the same. Update: Also doesn't work with Mendix 9.11.0 and 9.9.1
Are you missing an underscore in the ENUM in your Create Variable action for $StringVariable?
Well, this is exactly how I have been using StringToEnum a couple of time already. Without any issue like you describe. Workaround is to place an errorhandler on the java-call and make the errorhandler do it the old-fashioned way: if $YourString = ‘Enkelvoudig’ then return enum_JaarrekeningType.Enkelvoudig, if… etc
Also try it with any other enumeration, even just for practice. See if it will work then.