When a Model is used as an option source and the model contains a subquery condition, the condition value is not being applied correctly. The first time the condition has the correct value, but subsequent searches on the same field do not reflect the current condition value (it always remains what it was the first time).
Scenario Explained: User is choosing a field value for Field A on Model #1. User is choosing a field value for Field B on Model #2. The filter for Field B is based on a junction object where rows are retrieved that contains Field B but also contain Field A.
Steps to reproduce:
- Create page using XML below
- Preview page
- Click the “Parent Account Id” field mag glass
Expected Behavior = Actual Behavior
The list of available accounts to choose from are correctly filtered on the current accounts Owner. Only accounts that hvae the same owner are returned
- Change the Owner Id field to another user
- Click the “Parent Account Id” field mag glass
Expected Behavior
The list of accounts returned should contain accounts that are owned by the user set in Step #4
Actual Behavior
The list of accounts returned is the same as it was in Step #3
Sample Page XML
<skuidpage unsavedchangeswarning="yes" personalizationmode="server" showsidebar="true" showheader="true" tabtooverride="Account"> <models>
<model id="Account" limit="1" query="true" createrowifnonefound="false" sobject="Account" adapter="" type="" doclone="">
<fields>
<field id="Name"/>
<field id="CreatedDate"/>
<field id="Parent.ParentId"/>
<field id="Parent.Parent.Name"/>
<field id="Parent.OwnerId"/>
<field id="Parent.Owner.Name"/>
<field id="OwnerId"/>
<field id="Owner.Name"/>
<field id="ParentId"/>
<field id="Parent.Name"/>
</fields>
<conditions>
<condition type="param" enclosevalueinquotes="true" operator="=" field="Id" value="id"/>
</conditions>
<actions/>
</model>
<model id="AccountOwnedBy" limit="" query="false" createrowifnonefound="false" adapter="" type="" sobject="Account" doclone="no">
<fields>
<field id="Name"/>
<field id="OwnerId"/>
<field id="Owner.Name"/>
</fields>
<conditions>
<condition type="join" value="" field="OwnerId" operator="in" enclosevalueinquotes="true" joinobject="User" joinfield="Id">
<conditions>
<condition type="modelmerge" value="" field="Id" operator="=" model="Account" enclosevalueinquotes="true" mergefield="OwnerId" novaluebehavior="noquery"/>
</conditions>
</condition>
</conditions>
<actions/>
</model>
</models>
<components>
<pagetitle model="Account" uniqueid="sk-wz-99-70">
<maintitle>
<template>{{Name}}</template>
</maintitle>
<subtitle>
<template>{{Model.label}}</template>
</subtitle>
<actions>
<action type="delete"/>
<action type="clone"/>
<action type="share"/>
<action type="savecancel" window="self"/>
</actions>
</pagetitle>
<basicfieldeditor showsavecancel="false" showheader="true" model="Account" mode="edit" uniqueid="sk-wz-99-71" buttonposition="">
<columns>
<column width="50%">
<sections>
<section title="Basics" collapsible="no">
<fields>
<field id="Name"/>
<field id="ParentId" valuehalign="" type="" optionsource="model" optionmodel="AccountOwnedBy">
<searchfields/>
</field>
</fields>
</section>
</sections>
</column>
<column width="50%">
<sections>
<section title="System Info" collapsible="no">
<fields>
<field id="CreatedDate"/>
<field id="OwnerId"/>
</fields>
</section>
</sections>
</column>
</columns>
</basicfieldeditor>
</components>
<resources>
<labels/>
<css/>
<javascript/>
</resources>
<styles>
<styleitem type="background" bgtype="none"/>
</styles>
</skuidpage>