The new conditional rendering features added to the Dreamforce release are killer, thank you!
Came across an issue related to the proper evaluation of a conditional rendering property marked to number of rows in model. In appears that the evaluation is using === / !== and unfortunately the data types are different (data.length is numeric while the value from the xml is string). This results in incorrect evaluation.
Steps to reproduce:
- Create a new detail page for Account
- Remove everything except page title
- Add 3 templates
- First template with text “Show if RowCount == 1” set to conditionally render when # of rows in Account equals 1
- Second template with text “Show if RowCount != 1” set to conditionally render when # of rows in Account does not equal 1
- Third template with text “{{$Model.Account.data.length}}”
- Preview the page picking an account when prompted
Actual Result
Template #2 appears
Expected Result
Template #1 appears
Repro Page
<skuidpage unsavedchangeswarning="yes" showsidebar="true" showheader="true" tabtooverride="Account"> <models>
<model id="Account" limit="1" query="true" createrowifnonefound="false" sobject="Account">
<fields>
<field id="Name"/>
<field id="CreatedDate"/>
</fields>
<conditions>
<condition type="param" enclosevalueinquotes="true" operator="=" field="Id" value="id"/>
</conditions>
<actions/>
</model>
</models>
<components>
<pagetitle model="Account">
<maintitle>
<template>{{Name}}</template>
</maintitle>
<subtitle>
<template>{{Model.label}}</template>
</subtitle>
<actions/>
</pagetitle>
<template multiple="false" model="Account">
<contents>Show if RowCount == 1</contents>
<renderconditions logictype="and">
<rendercondition type="fieldvalue" operator="=" enclosevalueinquotes="true" fieldmodel="Account" sourcetype="modelproperty" nosourcerowbehavior="deactivate" sourceproperty="data.length" value="1"/>
</renderconditions>
</template>
<template multiple="false" model="Account">
<contents>Show if RowCount != 1</contents>
<renderconditions logictype="and">
<rendercondition type="fieldvalue" operator="!=" enclosevalueinquotes="true" fieldmodel="Account" sourcetype="modelproperty" nosourcerowbehavior="deactivate" sourceproperty="data.length" value="1"/>
</renderconditions>
</template>
<template multiple="false" model="Account">
<contents>Row Count = {{$Model.Account.data.length}}</contents>
</template>
</components>
<resources>
<labels/>
<css/>
<javascript/>
</resources>
</skuidpage>