Custom Widgets - Unable to trigger On click Action in custom widgets

Hi, I have created a custom widget which has property configured to invoke an action on click. However it doesnt trigger this action of Open Link/Call a microflow or any such actions specified.  Here is my properties configuration:     <properties>         <propertyGroup caption="General">         <property key="Caption" type="string" required="false">                 <caption>Details Disclosure</caption>                 <description>Enter the Label</description>             </property>             <property key="attributes" type="object" required="false" isList="true">                 <caption>Attributes</caption>                     <description></description>                 <properties>                    <property key="variablename" type="string" required="false" defaultValue="">                         <caption>Value</caption>                         <category>Variable</category>                         <description>Value</description>                    </property>                                        <property key="onClickAction" type="action" required="false">                         <caption>On click action</caption>                         <category>Action</category>                         <description>Action to trigger when button / label is clicked</description>                     </property>                                   </properties>             </property>         </propertyGroup>                </properties>
3 answers

Hi Vinutha,

With the XML you can specify a Microflow to be selected from Studio Pro. This in itself doesn’t do anything. Within the JavaScript file of the widget you have to couple this microflow from the XML, available via this.onClickAction to a UI element of the widget. So, create a div in your widget via the widget.html and add an on click event to this div that triggers this.onClickAction.

Good luck!


For adding an event handler to a div, this is plain javascript. You could also use the dojo.on library, for instance:

yourDomNode.on('click', dojoLang.hitch(this,function(d) {

    if (!this.onClickAction){

For actually triggering that microflow via the custom function ‘this._execMF’ you need the Mendix Client API function, i.e.:

_execMF : function (onClickAction){,{
                params:	{
                    applyto: 'selection',
                guids: [/*here you can add a Mendix guid as inputparameter for your microflow*/ ]

                progress: "modal",
                origin: this.mxform,
                error: dojoLang.hitch(this,function(error) {
                callback: dojoLang.hitch(this,function(result){			



This helps me open a new page:

mx.ui.openForm("Module/", {
             location: "popup",
                callback: function(form : any) {


But how do i make this page name properties driven? 



The widget context object 'this’ does not return page name selected on action(OnClickAction) attribute. Here is what i see when i inspect. I can see all other attributes apart from action items specified.