Get Microflow/Nanoflow Name in my pluggable widget

0
Hi There,   I'm creating a pluggable widget and I want to invoke a Nanoflow/Microflow when user clicks on the button from the widget.    If I can pass the Nanoflow/Microflow name directly like below its working fine.    mx.data.action({             params: {                 applyto: "selection",                 actionname: "SearchFilterModified.ACT_Account_ForgotPassword",                 //actionname: "forgotMF",                 guids: [ "281530811285515", "281530811285506"]             },             callback: function() {                 if (forgotMF && forgotMF.canExecute) {                     forgotMF.execute();                 }                 console.log( "Forgot Password Microflow Triggered Successfully!");             },             error: function (error) {                 mx.ui.error("Error Calling Forgot Password");             }         });   But, my expectation is I should read the microflow name through Props (React props)    I tried reading all the forum questions and I read the Mendix 9 API, but no clue till now.   Can someone help me resolve this.     Thanks   
asked
3 answers
0

Hey Amarnath!

 

I had the same problem and it seems that's not possible by default on Mendix. The only way to insert a microflow and a nanoflow is through the action property type but there is not a way to obtain the name from that property.

So, at least for now, your only solution is set a hard coded string. 

 

Kind regards.

answered
0

Yes that's probably correct. There are some limitations regarding the pluggable widgets.

This screenshoot is an example of the action property type as you see there. You cannot find any information regarding the microflow name. You only have the execute function to trigger it.

image.png

answered
0

Hi Emilio and Forum Members,

 

I have achieved the answer by changing the Property Type and removed the mx.data.action

 

Previous Code - XML

<propertyGroup caption="Events">
     <property key="forgotMF" type="action">
         <caption>Forgot Password Nanoflow/Microflow</caption>
         <description>Triggered on clicking the Forgot Password link</description>
     </property>
 </propertyGroup>

Previous Code - React 

mx.data.action({
            params: {
                applyto: "selection",

                actionname: "SearchFilterModified.ACT_Account_ForgotPassword",

                //actionname: "forgotMF",

                guids: [ "281530811285515", "281530811285506"]

            },

            callback: function() {
                if (forgotMF && forgotMF.canExecute) {
                    forgotMF.execute();

                }

                console.log( "Forgot Password Microflow Triggered Successfully!");

            },

            error: function (error) {
                mx.ui.error("Error Calling Forgot Password");

            }

        });

 

 

Changed code - xml

<propertyGroup caption="Events">
    <property key="forgotMF" type="action">
                <caption>Forgot Password Nanoflow/Microflow</caption>
                <description>Triggered on clicking the Forgot Password link</description>
     </property>
</propertyGroup>

Change code - React

if (forgotMF && forgotMF.canExecute) {
     forgotMF.execute();
}

 

On the above code forgotMF is a action name

 

We can use this code in the function and call the function from html and invoke when we do some actions (click or hover or key up or key press or whichever way)

 

Thanks

answered