I have a grid Visualforce component that displays records as rows where fields are editable as apex:inputField
. The component works for generic SObjects and uses fieldsets to defined editable fields.
In one usage each record has two dependent Lookup fields, where one defines a Filter on the other.
The problem is one of the fields is not rendered correctly (gray background to show dependency) and the other has a Lookup button that produces a JS error in a Salesforce-internal class main.js.
I could boil the problem down to see where the root cause is. The problem is passing the apex:inputField value attribute an SObject wrapped in a Wrapper object and using the generic map-method to access the field.
<apex:component controller="ComponentCtrl" allowDML="true">
<apex:attribute name="originalRecords" type="SObject[]" assignTo="{!recordList}" required="true" description="" />
{!getInit} <!-- Pseudo Constructor -->
<apex:pageBlock >
<h1>No wrapper class and it works!</h1>
<apex:pageBlockTable value="{!originalRecords}" var="originalRecord">
<apex:column >
<apex:inputField value="{!originalRecord['LookupField1__c']}" />
<apex:inputField value="{!originalRecord['LookupField2__c']}" />
</apex:column>
</apex:pageBlockTable>
<h1>With wrapper class and it FAILS!</h1>
<apex:pageBlockTable value="{!wrappedRecords}" var="wrapper">
<apex:column >
<apex:inputField value="{!wrapper.record['LookupField1__c']}" />
<apex:inputField value="{!wrapper.record['LookupField2__c']}" />
</apex:column>
</apex:pageBlockTable>
</apex:pageBlock>
</apex:component>
I think this problem might be connected to this Known Issue: Lookup Filter doesn't allow lookup window to open due to javascript error on order product multi-line edit page