Custom Widget error: The needsEntityContext attribute is not declared.

0
Hi, I’m trying to create a simple custom widget that allows me to trigger a microflow / nanoflow on page navigation. Want to do something similar to this forum post, where I have a widget in the layout that is used by all pages: https://community.mendix.com/link/questions/91858 Unfortunately I don’t think I can use the new pluggable widget framework for this seeing as I need to connect to the “onNavigation” event of mx.ui.getContentForm(). So I’ve been trying to use the older DOJO framework, but I’m having trouble getting the basic widget XML working in the Modeler (version 9.6.6.).  For some reason, this code from the docs page to add a Nanoflow to the widget options doesn’t work: <property key="validationNanoflow" type="nanoflow" required="false" needsEntityContext="true"> <caption>Validation Nanoflow</caption> <category>Behavior</category> <description>Return value: whether the given object is validated successfully</description> <returnType type="Boolean" /> </property> When I add that to the widget scafolding that comes out of the Yeoman generator & then build it, I get the following error in when loading the widget into the modeler: Widget XML file 'OnPageNavigationWidget/OnPageNavigationWidget.xml' does not conform to the XML schema: The 'needsEntityContext' attribute is not declared. Which is strange, because the ‘needsEntityContext’ attribute is declared? Is this maybe an issue with Mx9 and the older widget framework, or am I doing something wrong?
asked
1 answers
0

Apparently removing the attribute actually fixed it. I think you only need to add ‘needsEntityContext’ in the widget attributes, not for nanoflow and microflow attributes. So I now have this:

<widget id="OnPageNavigationWidget.widget.OnPageNavigationWidget" pluginWidget="false" needsEntityContext="false" xmlns="http://www.mendix.com/widget/1.0/">
    <name>OnPageNavigationWidget</name>
    <description>The description of this widget.</description>

    <icon />

    <properties>
        <property key="Nanoflow" type="nanoflow" required="false">
            <caption>Nanoflow</caption>
            <category>Flows</category>
            <description>Nanoflow to run on page navigation.</description>
            <returnType type="Void" />
        </property>
        <property key="Microflow" type="microflow" required="false">
            <caption>Microflow</caption>
            <category>Flows</category>
            <description>Microflow to run on page navigation.</description>
            <returnType type="Void" />
        </property>
    </properties>
</widget>

Which works.

answered