Child Field Conditions: Field from another model - Error (no row in source model)

  • 1
  • Problem
  • Updated 2 weeks ago
  • In Progress
  • (Edited)
I have a query on Accounts that is returning a Child Relationship for Contact. The Conditions for my child relationship are checking if the Birthdate field is within a particular range based on the values of LowBirthdate and HighBirthdate in a UI only model (field from another model).

This conditioning wasn't working and was just returning any birthdate.

I then set the condition to "Abort this Model's Query" If no row in Source Model, and now the query doesn't run, but there IS a row in the source model, and I'm also running this check via a subquery to only return accounts with contacts with a particular Birthdate range (field from another model) and that works just fine.

What's going on here? Why does my conditioning for Field from another model see no rows in the Child Relationship, but in the main query's subquery it's picking up the row properly? This seems like a bug.


Subquery field from another model works fine:


Child relationship to Contact (in the same model) condition: Field from another model sees no row in source model?
Photo of Mark L

Mark L

  • 928 Points 500 badge 2x thumb

Posted 1 month ago

  • 1
Photo of Brian Lee

Brian Lee, Official Rep

  • 620 Points 500 badge 2x thumb
Hi Mark,

Just waned to check if you are still in need of assistance with this issue? Were you able to resolve it? If not, we would like to know what version of skuid you are using and if this is an issue that used to work but no longer works. 

Additionally, how are your UI only fields set up regarding BirthDateHigh and BirthDateLow. Just wanted to see how you have it set up to see if the model with those UI only fields is querying before you query the model with the child relationship. 
Photo of Mark L

Mark L

  • 898 Points 500 badge 2x thumb
I have not been able to resolve this issue unfortunately. My SKUID version appears to be 12.1.7

I don't believe this ever worked; trying to get this to work just results in this error.

I have the UI only fields set up in a UI only model and are specified prior to running the query in the UI (field editor for this model, you enter the dates you're looking to filter on, the model is initially loaded with a row in it, it is never saved). As I stated above, in the same query the subquery references these fields and works, whereas the Child conditioning references these fields and does not work, so it shouldn't have anything to do with model loading order.

In a separate issue I was having I discovered that there were errors in SKUID when trying to compare UI only model date fields to Salesforce date fields; by using a real Salesforce object I created for the sole purpose of working with temporary variables for use with SKUID and comparing real Salesforce date to real Salesforce date I was able to get that condition logic working, but this seems to be a separate issue since it seems to be acting as if there's no row in the source model when there definitely is a row in the source model. I haven't yet tried to use my real Salesforce model here instead of the UI only model to see if that changes anything, but even if it does this very much seems like a bug. I'll try that next.
Photo of Mark L

Mark L

  • 898 Points 500 badge 2x thumb
I changed it over to using my Salesforce variable model instead of a UI only model and it still acts as if there is no row in the source model on the conditioning of the child relationship.
Photo of Mark L

Mark L

  • 898 Points 500 badge 2x thumb
I'm also using the v1 API / editor
Photo of Brian Lee

Brian Lee, Official Rep

  • 620 Points 500 badge 2x thumb
Hey Mark, 

Thanks for the additional information. Do you think you could possibly reproduce the issue by recreating a simplified version from scratch using only standard salesforce objects and fields and provide us with the xml for that so we can investigate the issue?
Photo of Mark L

Mark L

  • 898 Points 500 badge 2x thumb
The following XML is a simplified page using only basic account and contact fields (specifically Birthdate on Contact) and a UI only model to specify the date range of birthdates.

While running this page, the sample Database should include accounts that have contacts underneath them with birthdates in the date range specified as well as contacts that have birthdates outside the date range specified. It should also include accounts that have contacts with birthdates only outside the birthdate range specified.

Running this you'll see that it properly filters the accounts (via the subquery on contacts) to only show accounts that have contacts within the birthdate range, but you'll also see that the Child relationship is not filtering children based on the birthdate range field from another model condition. If you change the child relationship conditioning (field from another model) to abort query if no row in source model, the query will be aborted and no rows returned.

XML:

<skuidpage personalizationmode="server" showsidebar="false" showheader="false" globalfeedbackenabled="false"> <models> <model id="Variables" limit="20" query="true" createrowifnonefound="true" datasource="Ui-Only" processonclient="true"> <fields> <field id="BirthDateLow" displaytype="DATE" ogdisplaytype="TEXT" label="BirthDateLow" defaultvaluetype="fieldvalue"/> <field id="BirthDateHigh" displaytype="DATE" label="BirthDateHigh" ogdisplaytype="TEXT"/> <field id="RunQuery" displaytype="DOUBLE" ogdisplaytype="TEXT" precision="1" scale="0" defaultvaluetype="fieldvalue" defaultValue="0"/> </fields> <conditions/> <actions> <action> <actions> <action type="branch" whenfinished="continue"> <formula>{{RunQuery}} = 1</formula> <iftrueactions> <action type="blockUI" message="Running Query"/> <action type="updateRow" fieldmodel="Report_MemberFamiliesAdultsChildren__Variables" affectedrows="context"> <updates> <update valuesource="fieldvalue" field="RunQuery" enclosevalueinquotes="false" value="0"/> </updates> </action> <action type="requeryModel" model="PrimaryQuery" behavior="standard"/> <action type="unblockUI"/> </iftrueactions> </action> </actions> <events> <event>row.updated</event> </events> <fields> <field>RunQuery</field> </fields> </action> </actions> </model> <model id="PrimaryQuery" query="false" createrowifnonefound="false" datasource="salesforce" sobject="Account" processonclient="true" limit="100"> <fields> <field id="Id"/> <field id="Name"/> <field id="Contacts" type="childRelationship" limit="10"> <fields> <field id="Name"/> <field id="Birthdate"/> </fields> <conditions> <condition operator="gte" type="modelmerge" field="Birthdate" value="" model="Variables" enclosevalueinquotes="false" mergefield="BirthDateLow" novaluebehavior="deactivate"/> <condition operator="lte" type="modelmerge" field="Birthdate" value="" model="Variables" enclosevalueinquotes="false" mergefield="BirthDateHigh" novaluebehavior="deactivate"/> </conditions> </field> </fields> <conditions> <condition type="join" value="" operator="in" enclosevalueinquotes="true" joinobject="Contact" joinfield="AccountId" fieldtargetobjects="Account" field="Id"> <conditions> <condition type="modelmerge" value="" field="Birthdate" operator="gte" model="Variables" enclosevalueinquotes="false" mergefield="BirthDateLow" novaluebehavior="noquery"/> <condition type="modelmerge" value="" field="Birthdate" operator="lte" model="Variables" enclosevalueinquotes="false" mergefield="BirthDateHigh" novaluebehavior="deactivate"/> </conditions> </condition> </conditions> <actions/> </model> </models> <components> <basicfieldeditor showheader="true" showsavecancel="false" showerrorsinline="true" model="Variables" uniqueid="sk-3vU_-467" mode="edit" layout="above"> <columns> <column width="50%" uniqueid="sk-3vU_-463"> <sections> <section title="Contact Birthdates" uniqueid="sk-3vU_-464" collapsible="no"> <fields> <field uniqueid="sk-3vU_-470" id="BirthDateLow"/> <field uniqueid="sk-3vU_-471" id="BirthDateHigh"/> <field uniqueid="sk-3vVG-624" type="BUTTON"> <text>Run Query</text> <actions> <action type="updateRow" fieldmodel="Variables" affectedrows="context"> <updates> <update valuesource="fieldvalue" field="RunQuery" enclosevalueinquotes="false" value="1"/> </updates> </action> </actions> <renderconditions logictype="and" onhidedatabehavior="keep"/> <enableconditions logictype="and"> <condition type="blank" operator="!=" fieldmodel="Variables" sourcetype="fieldvalue" field="BirthDateLow" value="null" enclosevalueinquotes="false"/> <condition type="blank" operator="!=" fieldmodel="Variables" sourcetype="fieldvalue" field="BirthDateHigh" value="null" enclosevalueinquotes="false"/> </enableconditions> </field> </fields> </section> </sections> </column> <column width="50%" uniqueid="sk-3vU_-465"> <sections> <section title="Section B" uniqueid="sk-3vU_-466" collapsible="no" showheader="false"> <fields/> </section> </sections> </column> </columns> <renderconditions logictype="and"/> </basicfieldeditor> <skootable showconditions="true" showsavecancel="false" showerrorsinline="true" searchmethod="server" searchbox="true" showexportbuttons="true" hideheader="false" hidefooter="false" pagesize="10" alwaysresetpagination="false" createrecords="false" model="PrimaryQuery" buttonposition="" mode="readonly" allowcolumnreordering="true" responsive="true" uniqueid="sk-2Not-825"> <fields> <field id="Name" hideable="true" uniqueid="fi-3vWE-1202"/> <field id="Contacts" type="CHILDREL" limit="100" hideable="true" uniqueid="fi-2Nqx-1769" allowhtml="true"> <label>Contacts</label> <template>{{Name}}: ({{Birthdate}})&lt;br&gt;</template> <renderconditions logictype="and" onhidedatabehavior="keep"/> <enableconditions/> </field> </fields> <rowactions/> <massactions usefirstitemasdefault="true"/> <views> <view type="standard"/> </views> <renderconditions logictype="and"/> <exportproperties usetablecolumns="true" appendrowidcolumn="false" loadallrecords="true"/> </skootable> </components> <resources> <labels/> <javascript/> <css/> <actionsequences uniqueid="sk-2NST-335"/> </resources> <styles> <styleitem type="background" bgtype="none"/> </styles> <interactions/> </skuidpage> 

(Edited)
Photo of Brian Lee

Brian Lee, Official Rep

  • 620 Points 500 badge 2x thumb
Hello Mark, 

Apologies for the delayed reply. Thank you for providing us with that xml. This does appear to be a bug and I will be sending this over to our engineering team for review. Thank you for bringing this to our attention. We will follow up should we discover a workaround. Otherwise we will update you once this has been fixed in a future release.