When a formula field on Model A references a field on Model B, an exception “Uncaught TypeError: Cannot read property ‘displaytype’ of undefined” is encountered.
Notes
- Model A is listed before Model B in the model page order
- During evaluateFormulas, Model B is found, however when it calls ‘getField’ on Model B, fieldsMap is undefined
Steps to reproduce:
- Create page using XML below
- Preview page picking an account
Expected Behavior
Page renders successfully
Actual Behavior
Page does not render due to exception
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="">
<fields>
<field id="Name"/>
<field id="CreatedDate"/>
<field id="FirstContactName" uionly="true" displaytype="FORMULA" readonly="true" returntype="TEXT" label="FirstContactName">
<formula>{{$Model.Contact.data.0.Name}}</formula>
</field>
</fields>
<conditions>
<condition type="param" enclosevalueinquotes="true" operator="=" field="Id" value="id"/>
</conditions>
<actions/>
</model>
<model id="Contact" limit="" query="true" createrowifnonefound="false" adapter="" type="" doclone="" processonclient="true" sobject="Contact">
<fields>
<field id="Id"/>
<field id="Name"/>
<field id="AccountId"/>
<field id="Account.Name"/>
</fields>
<conditions>
<condition type="modelmerge" value="" field="AccountId" operator="=" model="Account" enclosevalueinquotes="true" mergefield="Id" novaluebehavior="noquery"/>
</conditions>
<actions/>
</model>
</models>
<components>
<pagetitle model="Account" uniqueid="sk-cNOcY-70">
<maintitle>
<template>{{Name}}</template>
</maintitle>
<subtitle>
<template>{{Model.label}}</template>
</subtitle>
<actions>
<action type="savecancel" window="self"/>
</actions>
</pagetitle>
<basicfieldeditor showsavecancel="false" showheader="true" model="Account" mode="read" uniqueid="sk-cNOcY-71">
<columns>
<column width="50%">
<sections>
<section title="Basics">
<fields>
<field id="Name"/>
<field id="FirstContactName" valuehalign="" type=""/>
</fields>
</section>
</sections>
</column>
<column width="50%">
<sections>
<section title="System Info">
<fields>
<field id="CreatedDate"/>
</fields>
</section>
</sections>
</column>
</columns>
</basicfieldeditor>
<skootable showconditions="true" showsavecancel="true" showerrorsinline="true" searchmethod="server" searchbox="true" showexportbuttons="false" pagesize="10" createrecords="true" model="Contact" buttonposition="" mode="read" uniqueid="sk-cNaQf-118">
<fields>
<field id="Name"/>
</fields>
<rowactions>
<action type="edit"/>
<action type="delete"/>
</rowactions>
<massactions usefirstitemasdefault="true">
<action type="massupdate"/>
<action type="massdelete"/>
</massactions>
<views>
<view type="standard"/>
</views>
</skootable>
</components>
<resources>
<labels/>
<css/>
<javascript/>
</resources>
<styles>
<styleitem type="background" bgtype="none"/>
</styles>
</skuidpage>