A close form instruction is a so-called component call, which is executed on the caller of the microflow (your widget). The easiest way to handle close form instructions in your widget is:
Mixing in mxui.mixin._Scriptable
Define 'mxui.mixin._Scriptable' as a mixin for the widget. This mixin adds some methods to the widget, which are used by the client to invoke instructions from the server.
mxui.widget.declare("your.custom.widget", {
mixins : [ mxui.mixin._Scriptable ],
startup : function() {
// ...
}
});
Handle close form instructions
While constructing the widget, show that the widget can handle close form instructions:
this.offerInterface("close");
Implement the close method
Create a method to be called when a close form instruction is returned. If the current form should be closed, this method would look like:
close : function() {
this.disposeContent();
}
Let your widget be the caller
Pass a reference to the widget when executing the microflow so that component calls are executed on the widget:
mx.ui.action("your.microflow", {
caller : this,
callback : function() {
// ...
}
}