condition on ui-only formula field not working.

  • 2
  • Problem
  • Updated 2 years ago
  • Not a Problem
Anyone have an explanation for this?


Here's a video with the full story:
Photo of Matt Sones

Matt Sones, Champion

  • 31,478 Points 20k badge 2x thumb

Posted 2 years ago

  • 2
Photo of Barry Schnell

Barry Schnell, Champion

  • 18,086 Points 10k badge 2x thumb

Hey Matt -

Lots of models involved and was a little bit difficult to follow the relationships/sequence in the video. That said, I think what you are trying to do is apply a Model Condition that is based on a UI Only field, correct?

If so, then I believe this is not supported. The reason for this is that Skuid issues a SOQL statement to retrieve the data. Since UI Only fields are client-side only, it cannot include the UI Only field in the SOQL.

Below is a sample page that demonstrates what I think you are trying to do. If you inspect the skuid.$M('Account').soql you'll see the condition "HasParent" isn't even applied. I tried to get cute and set the filter search on the table to "Client" hoping that it would use the HasParent condition but that didn't work either.

Short story - if I'm understanding your scenario correctly, the issue here is not that the records aren't filtering but rather that the UI Only field should not be selectable as a field on the Model condition since Skuid is going to have to ignore it anyway. I would consider that part a bug.

If I'm misunderstanding your scenario, just lemme know :)

<skuidpage unsavedchangeswarning="yes" personalizationmode="server" showsidebar="true" showheader="true" tabtooverride="Account">
    <models>
        <model id="Account" limit="100" query="true" createrowifnonefound="false" adapter="salesforce" service="salesforce" sobject="Account" type="">
            <fields>
                <field id="Name"/>
                <field id="CreatedDate"/>
                <field id="ParentId"/>
                <field id="Parent.Name"/>
                <field id="HasParent" uionly="true" displaytype="FORMULA" label="Has Parent" readonly="true" returntype="BOOLEAN">
                    <formula>{{ParentId}} != ""</formula>
                </field>
            </fields>
            <conditions>
                <condition type="fieldvalue" value="true" enclosevalueinquotes="false" field="HasParent" state="filterableoff" inactive="true" name="HasParent" operator="="/>
            </conditions>
            <actions/>
        </model>
    </models>
    <components>
        <pagetitle model="Account" uniqueid="sk-385123-74">
            <maintitle>
                <template>{{Model.labelPlural}}</template>
            </maintitle>
            <subtitle>
                <template>Home</template>
            </subtitle>
            <actions>
                <action type="savecancel"/>
            </actions>
        </pagetitle>
        <skootable showconditions="true" showsavecancel="false" searchmethod="client" searchbox="true" showexportbuttons="false" pagesize="10" createrecords="true" model="Account" mode="read" uniqueid="sk-385123-75" emptysearchbehavior="query">
            <fields>
                <field id="Name" allowordering="true"/>
                <field id="CreatedDate" allowordering="true"/>
                <field id="ParentId" valuehalign="" type=""/>
                <field id="HasParent" type="" valuehalign=""/>
            </fields>
            <rowactions>
                <action type="edit"/>
                <action type="delete"/>
            </rowactions>
            <massactions usefirstitemasdefault="true">
                <action type="massupdate"/>
                <action type="massdelete"/>
            </massactions>
            <views>
                <view type="standard"/>
            </views>
            <filters>
                <filter type="toggle" filteroffoptionlabel="New Filter" createfilteroffoption="true" affectcookies="true" autocompthreshold="25" conditionsource="manual" labelmode="auto" label="Has Parent Only">
                    <effects>
                        <effect action="set" value="true" condition="HasParent"/>
                    </effects>
                </filter>
            </filters>
            <searchfields/>
        </skootable>
    </components>
    <resources>
        <labels/>
        <css/>
        <javascript/>
    </resources>
    <styles>
        <styleitem type="background" bgtype="none"/>
    </styles>
</skuidpage>
(Edited)
Photo of Rob Hatch

Rob Hatch, Official Rep

  • 44,006 Points 20k badge 2x thumb
TL DR  (as in Too Late...)  But Barry is right.  UI ONly fields cannot be used in model conditions because the model condition is affecting the SOQL and how the database is being requeried.  The UI only field is not in the database....   Sorry. 
Photo of Barry Schnell

Barry Schnell, Champion

  • 18,086 Points 10k badge 2x thumb
Thanks for confirming Rob.

Matt - Assuming this is your use case, I'd recommend filing a new community issue around the fact that UI Only fields are "selectable" in Model Conditions and they should not be since they are ignored.  Hopefully avoid others from running in to the same questions and saving them some cycles.