UI Field Conditions

Is there a trick to getting UI-field based conditions working?

I have a UI field that checks two values and if they differ, sets its (boolean) value to true. I then have a condition that uses this field to filter out rows that don’t equal true, which doesn’t seem to work (I see both rows with true & false). Any help would be appreciated.

<skuidpage unsavedchangeswarning="yes" personalizationmode="server" showsidebar="true" showheader="true">
 <models> <model id="User" limit="1" query="true" createrowifnonefound="false" adapter="" type="" sobject="User" doclone=""> <fields> <field id="Id"/> <field id="Name"/> </fields> <conditions> <condition type="userinfo" value="" field="Id" operator="=" enclosevalueinquotes="true" userinfotype="userid"/> </conditions> <actions/> </model> <model id="InvoiceList" limit="100" query="true" createrowifnonefound="false" adapter="" type="" sobject="SCMC__Invoicing__c" doclone="" processonclient="false"> <fields> <field id="Name"/> <field id="SCMC__Total_Invoice__c"/> <field id="AC_Recent_SIN__c"/> <field id="AC_Recent_SIN__r.Name"/> <field id="AC_Recent_SIN__r.c2g__InvoiceTotal__c"/> <field id="Differs" uionly="true" displaytype="FORMULA" precision="9" scale="2" readonly="true" returntype="BOOLEAN" label="Differs"> <formula>ROUND({{SCMC__Total_Invoice__c}}) != ROUND({{AC_Recent_SIN__r.c2g__InvoiceTotal__c}})</formula> </field> <field id="DifferAmount" uionly="true" displaytype="FORMULA" label="Differ Amount" precision="9" scale="2" readonly="true" returntype="CURRENCY" defaultValue="0"> <formula>ROUND({{SCMC__Total_Invoice__c}}) - ROUND({{AC_Recent_SIN__r.c2g__InvoiceTotal__c}})</formula> </field> </fields> <conditions logic=""> <condition type="blank" value="null" field="AC_Recent_SIN__c" operator="!=" enclosevalueinquotes="false"/> <condition type="fieldvalue" value="true" enclosevalueinquotes="false" field="Differs" operator="=" state="" inactive="false"/> </conditions> <actions/> </model> </models> <components> <pagetitle model="User" uniqueid="sk-3wZng3-160"> <maintitle>Invoice SIN Discrepancy</maintitle> <subtitle>Welcome back {{Name}}</subtitle> <actions/> </pagetitle> <skootable showconditions="true" showsavecancel="false" showerrorsinline="true" searchmethod="server" searchbox="true" showexportbuttons="false" pagesize="10" createrecords="false" model="InvoiceList" buttonposition="" mode="readonly" uniqueid="sk-3wa3Ge-210" emptysearchbehavior="query" tokenizesearch="true"> <fields> <field id="Name" valuehalign="" type=""/> <field id="SCMC__Total_Invoice__c" decimalplaces="" valuehalign="" type=""> <label>SCM Total</label> </field> <field id="AC_Recent_SIN__c" valuehalign="" type=""/> <field id="AC_Recent_SIN__r.c2g__InvoiceTotal__c" decimalplaces="" valuehalign="" type=""> <label>SIN Total</label> </field> <field id="Differs" decimalplaces="" valuehalign="" type=""/> <field id="DifferAmount" decimalplaces="" valuehalign="" type=""/> </fields> <rowactions/> <massactions usefirstitemasdefault="true"/> <views> <view type="standard"/> </views> <searchfields/> <filters/> </skootable> </components> <resources> <labels/> <javascript/> <css/> </resources> <styles> <styleitem type="background" bgtype="none"/> </styles> </skuidpage>

What type of Model condition are you using?

Always on or 
Filterable Default off or
Filterable Default on?


I tried both “Always On” and a table filter toggle activating a “Filterable Default Off”.

Unfortunately, UI-Only fields mean just that, they’re for the UI-Only. The fact that you can add these fields to model conditions in the Builder is a bug. Model conditions are translated directly into SOQL queries on Salesforce’s servers, and Salesforce’s servers know nothing about UI-Only fields that were created in Skuid.

We’ll be removing the ability to do that in a future release. Sorry for the confusion.

Thanks for info Ben. Damn shame that they can’t be used in conditions. It would really help us get around Salesforce limits for cross-object formula fields and/or creation of workflow rules/fields for conditional usage.

Is there some way to “remove all rows in model” that meet certain values of a UI-Only model? LIke a post page load auto row removal?

Pretty sure you could run a snippet that iterated through all rows and removed the ones that matched your UI-Only field.   Javascript.  your friend. your enemy…

If you have a model action initiated by when model requeried, would that fire when the page first loads if the model is set to load on page load? thinking I could add the snippet as a model action, that way if I filtered my table it would re-run it. brings up a second question - do table filters re-process the model, as in if I remove some rows from my model using the above snippet, and then I change a table filter, will it re-query the model to pull in all rows to filter, or will it just filter on the rows that are loaded in my model now?

Hi - kind of related question - can UI only fields be used as a render condition on a component? 

Yes they can. Is there a specific use case you’re having trouble with?

Just stumbled on this old post, and wanted to assert that you can use UI-only fields as conditions in a model, as long as you query the model after page load. 

Yes - the UI field formula is working fine - i can display the formula result on the page. When I try to use that UI only field (it’s from an aggregate model, btw) in a component’s render condition - the page builder automatically adds a new aggregate field to the model and then throws an error when I’m previewing the page. 

https://cl.ly/f64414ee8a85

Removing the automatically added field from the aggregate model removes the render condition from the component. 

https://cl.ly/92734b049c42

Your Model Lookup formula is broke. It’s missing the field from AggAllAssignments that you’re using to do the vlookup in C5Project model. 

Should be something like: MODEL_LOOKUP (“C5Project”, “Planned_Hours__c”,“MATCHING_FIELD_IN_C5Project__c”,{{MATCHING_FIELD_FROM_AggAllAssignments}} )

I wouldn’t try to combine the model lookup and the IF then. Instead use one with model lookup to get your Planned_Hours__c value from the C5 model that corresponds to whatever row in C5 matches to AggAll, then add another UI only formula field true/false that checks the value of that field and compares to AllPlannedHours

You may still get issues, but I’d start here. 

If you are still getting issues after fixing all that - if you can upgrade Skuid do that first. If you’re on the latest or can’t upgrade - here’s a hack workaround:

Add your render condition like you did
go to View/Edit XML and:
 1)find your render condition and change it to reference the correct UI-only field
 2)delete the other field it auto-created
go back to Page Builder

If you have to do that hack, it’s worth creating a new post detailing this problem. If you’re adding render conditions based on ui-only fields on an agg model it shouldn’t auto-add a new field. 

Thanks for your help, Jack. I’m not following, though. In your “should be something…” the “Planned_Hours__c” is the ‘matching field in c5 project’ - that is the field i want to compare to the field from AggAllAssignments (PlannedHoursDifferent)

The field seems to be working fine and displaying fine until I try to use it in a render condition.

I followed your suggestion to grab the Planned_Hours__c from the C5Project model in one UI only field on the AggAllAssignments model. Used that in a separate UI only field to compare the two.

This still works fine as a UI only field on the page and displays the correct value - but when I try to use it in a component’s render condition the page builder automatically creates a new aggregate field on the model and throws the same error.

Sounds like you’ve found a new way to use Model Lookup :slight_smile:

I’ve always used it like this:
MODEL_LOOKUP(Lookup_Model_Id,Model_Field_To_Return,Model_Field_To_Search,Search_Value)

See my most recent post about the XML hack to see if it solves it. If it’s easier you can post the XML for your page here

XML hack did the trick! Thank you so much! :slight_smile: