Skuid v2 - Is model meant to call actions on its initial load?

Hello,

If there is a Salesforce Model which has ‘Query on page load’ off, and the model has ‘Model required’ for its initialising event. Are the actions meant to be executed.

If not, anyway around this?

I want to have a filter model, which gets queried when a filter is selected and in turn runs certain actions. Though, currently its executing actions on Page load which only be executed during ‘Model required’ event and this is interfering with initialisation of page or causes things very messy initialisation.

Best,

Lukas

<skuid__page unsavedchangeswarning=“yes” personalizationmode=“server” showsidebar=“true” showheader=“true”>

<models>

    <model id="SkuidPages" limit="" query="false" createrowifnonefound="false" datasource="salesforce" sobject="skuid__Page__c">

        <fields>

            <field id="Name"/>

        </fields>

        <conditions/>

        <actions>

            <action>

                <actions>

                    <action type="custom" snippet="newSnippet"/>

                </actions>

                <events>

                    <event>models.loaded</event>

                </events>

            </action>

        </actions>

    </model>

</models>

<components/>

<resources>

    <labels/>

    <javascript>

        <jsitem location="inlinesnippet" name="newSnippet" cachelocation="false">const params = arguments[0];

console.log('test');

console.log(params);
    </javascript>

    <css/>

    <actionsequences/>

</resources>

<styles>

    <styleitem type="background" bgtype="none"/>

</styles>

</skuid__page>

This is a point of frequent confusion that we could probably better manage. The property you set in the Model “Query on page load” only controls whether a Data query is made. A Metadata query is ALWAYS made on page load - and Skuid needs that information for the propert construction of the page.

Then confusingly - the model action trigger event “model requeried” fires whenever a model is queried for data OR metadata. So it will always fire on page load.

That’s just the way it works.

What we have seen folks do is add a branch action to the beginning of the action sequence that only allows the sequence to move forward if a UI boolean is true - and when the boolean is false - its branch sets the value to true. This lets the sequence run harmlessly on page load when the metadata is loaded, but then be available to run “for Realz” on subsequent model requeries.

Again - we know this is confusing, but have not figured a way to effectlvey modify the experience creating a lot of regressions.

Also - I notice you running a snippet just to detect the firing of the action sequence. Do you ever use the debug api? In the JS console try: skuid.debug.actions.loggingOn(). It will give you evidence of all your actions…

Hello Rob,

I could probably have done better research beforehand. Nonetheless, thank you for confirming it, and providing a potential work around.

Thank you point of skuid.debug, just started and its already being useful!

Best,

Lukas