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!
EDIT:
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){
this._execMF(onClickAction);
}
}));
For actually triggering that microflow via the custom function ‘this._execMF’ you need the Mendix Client API function mx.data.action, i.e.:
_execMF : function (onClickAction){
mx.data.action(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);
}
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.
This helps me open a new page:
mx.ui.openForm("Module/Test.page.xml", {
location: "popup",
callback: function(form : any) {
console.log(form.id);
}
});
But how do i make this page name properties driven?