close page not working when calling microflow with, because origin this.mxform is undefined

Hi, I’m working on a pluggable widget. I call a microflow from within it with “”. Inside the microflow I perform a “close page”. The issue I have now is that it doesn’t close the popup the widget is on. I found other questions regarding this issue. The gist metioned is that you need to specify the “origin” in the request, so that the “close page” works properly.   This is also supported by the documentation which states for the property “origin”: the page on which instructions returned by the server ('close form' in particular) can be executed   example:{ params: { actionname: microflowName }, origin: this.mxform }); I see a lot of code snippets like this referring to “this.mxform”.    But in my case this is always undefined.   How exactly do I get this mxform ?   - Tobias
2 answers

Hi Tobias,

I'm not too experienced with pluggable widgets yet, but I do know that mxform is a property of Custom widgets (i.e. the dojo ones), as mentioned in the api docs.. The this.mxform you found in other posts is probably referenced from that context.
I can't immediately find a substitute for that property in the pluggable widgets documentation, but you could try checking whether it might be passed as a prop to the widget (something like this.props.mxform I guess?)

Good luck!



Okay, I managed to find a solution. 

It’s a pretty ugly workaround but it does it’s job and I couldn’t find any other solution.


Basically what I did is change the microflow to return a string, in my case it’s just the value “close page”. I additionally added a button outside the widget on the popup, hid it with css (display: none) and gave it a class to find it in the dom from within the widget (.btn-close),

In the widget I process the response and check if it matches “close button”, if it does I simply simulate a click on that button:

callback: function (obj) {
    if (obj === 'close page') {
        const closeButtons = document.getElementsByClassName('btn-close');
        if (closeButtons.length > 0) {

I hope this helps someone

- Tobias