Pluggable Widget - Invalid Child Element actionVariables

0
Hi,    From the Mendix API Documentation > Studio Pro 10 > Pluggable Widgets API > Property Types, I can see that it is possible to provide a microflow or nanoflow with XML elements: see here.   We also get an example of how to achieve this: <property key="actionWithVariable" type="action"> <caption>On click</caption> <description>Action to be performed when button is clicked</description> <actionVariables> <actionVariable key="random" type="Decimal" caption="Random number between 0 and 1" /> </actionVariables> </property>   But when I copy past this example to my Pluggable Widget's XML file and try to use it on a Mendix app in Mendix Studio Pro 10.6.23, I get the error below:     Do you have any idea why this happens?   Thank you in advance, João
asked
2 answers
0

Hey João,

If I'm not mistaken the property <actionVariables> is only available for 10.10 or higher.

 

To fix your problem try this:

 <property key="random" type="decimal">
      <caption>Random number between 0 and 1</caption>
      <description>A decimal value generated by the widget</description>
    </property>

    <!-- Action property -->
    <property key="onClick" type="action">
      <caption>On Click</caption>
      <description>Action to be executed when the button is clicked</description>
    </property>

And then, you can call it using the OnClick property on Typescript

If this helped, click to accept :)

 

Best Regards,

Ricardo Pereira

answered
1

Hi João, 

 

Action Variables were introduced with Mendix 10.21. Usually we add a banner indicating when a feature was introduced if it is new in that major, but I see we missed it here. I will make sure the disclaimer is put there.

Looking at your post I believe you want the widget to expose some values on click. Before 10.21 your best option is an Attribute Property which you set the value on before calling the execute() method of the Action. In Studio Pro the widget is then nested inside a dataview with an entity that the attribute can be set to. You can then use the same attribute in the Microflow's parameter mappings.

 

I hope this helps,

Arjo

answered