Set enumeration attribute value inside JavaScript action

0
I have a JS action in native app which sets attribute values of an object. For example, we can set string attributes like this:   mxobj.set("Name", "Henry"); Now if there is an enumeration attribute “Status” having two values: online and offline (Assume we have same caption and name) I tried setting it like string but it did not work.  mxobj.set("Status", "online"); So, how to give values to enum attributes inside JS?
asked
2 answers
0

Hey Umar,

I'm not sure if this helps, but following the documentation, the is a function to get the enum map:

https://apidocs.rnd.mendix.com/7/client/mendix_lib_MxMetaObject.html#getEnumMap

Following this logic, maybe it is possible to do it like this:

mxobj.set("Status", { key : "online",   caption : "online" });

 

answered
0

Hi Umar,

I’m 99% sure you’re doing it right. Are you sure you have write permissions to that enumeration?

answered