Run Microflow from JS

3
Hi all, i am trying to run Microflow within widget JS file: mx.processor.xasAction({ error : function() { logger.error(this.id + "error: XAS error executing microflow"); }, actionname : 'GetStaffFromDepartmentsRota', guids : [givenObject.getGUID()], callback: dojo.hitch(this, this.test) }); Action name is name of microflow from mendix. My flow is allowed for all roles, but i always got NetworkError 560. Any idea, where can be problem? regards, Lukas
asked
3 answers
1

You need to add the module in front of the microflow name.

Either way it's best to have the user set these in your widget properties, instead of hardcoding these in.

Try this in your xml:

<property key="buttonmf" type="microflow" required="true">
                <caption>Microflow</caption>
                <category>Action</category>
                <description></description>
                <returnType type="Void"/>
</property>

That should give you a string with the correct microflow name the user selected, which you can use as the actionname

answered
1

For returning lists in the xml:

<returnType type="Object" isList="true" entityProperty="entity"/>

And here is the beginning of a callback that can process the result set:

 processSearchResult : function(data) {
        var newitems = [];
        if (data.actionResult !== "") { //if we return empty in the MF, it will come in here as empty string...
            for(var i = 0; i < data.actionResult.length; i++)
                newitems.push(mx.processor.setOrRetrieveMxObject(data.actionResult[i]));
answered
0

Oki, I am trying to include it in the widget properties. But. What if my microflow return List of Objects? How can i change the return type?

answered