You need to sign in to do that
Don't have an account?
Dynamic Binding with Field Set within List causes error with no details
Ok so here's the scenario.
I have a map that contains a list of field names. On the page I'm iterating through the map and for each item in the map I iterate over the list of field names.
When I attempt to get the outputfield using dynamic binding I get an error -- but no error message.
If I pull out one of the lists in the extension and iterate through that list it works fine. It only errors when I attempt to display the information within a nested item.
Here's a slimmed down version of (example test) of what's in the controller
map<string,list<string>> mFields = new map<string,list<string>>(); list<string> templist = new list<string>(); for(Schema.FieldSetMember fm : Sobject.Case.FieldSets.TestSet.getFields()){ templist.add(fm.getFieldPath()); } mFields.put('test',templist); templist = new list<string>(); templist.add('Subject'); templist.add('ContactID'); MFields.put('Test2',templist);
And then the page: I can't even save this because it doesn't like the Case[f]. It'll accept {!f} but nothing that'll let me reference the field. and I do a soql query for the fields in the controller, it's just not in the sample above.
<apex:pageblock title="tests"> <apex:repeat value="{!mfields}" var="c"> <apex:pageblocksection columns="2"> <apex:repeat value="{!mFields[c]}" var="f"> <apex:outputfield value="{!Case[f]}" /> </apex:repeat> </apex:pageblocksection> </apex:repeat> </apex:pageblock>
Now if I remove the first repeat and replace the value of the second repeat with say TempList (after making it available) it works great... It's only when I'm pulling it through the map.
Thoughts?
What is the controller specified in the page definition? Is this set controller or standard or ....
The reference case[f] looks suspicious to me. You are going to need some controller method that returns the specific Case object whose field [f] you are going to display.
Thanks for the reply!
I'm using the standardController="Case" with an extension as my class.
I've gotten the case[f] working if I just use the list of strings (not the nested one).
I've also tried having a method that queried all the needed fields for the case record (MyCase) and tried {!MyCase[f]} which provided me the same error with no actual error message.
Similar to the case[f] version it works if I don't use the nested list of strings.
Interesting. Seems like it ought to work if Case is valid. I'll play with it a bit.
Okay, I've done some more testting and here's what I've found.
It has something to do specifically with the list being nestled. In this scenario I'm nestling a list of field names (from a field set) within a map (key's are string).
So here's my example:
here's a snippet of the controller. I have two vairables i'm going to call on my VF page. LFSM is a list of strings containing fields from the fieldset. mLtest is a map of a list of strings containing fields from a field set.
So in this method I'm simply building out the list of fields and either putting them in LFSM or mLTest.
And on the page the list<string> (LFSM) but when I iterate through the map i get a red ! with no error message... but
so this works:
This gives me the error:
And this removes the error with no message, but only displays the name of the field:
Looking at a debug log I see something interesting comparing the value from the Map list vs just a list. I don't know if that would impact it:
12:12:10:130 USER_DEBUG [59]|DEBUG|TEST Map string to FSM string: (Physician_List_Format__c) FSM string: Physician_List_Format__c
You can see that the value from the list that's nestled in the map outputs with (), but the value from the plain list doesn't.
Thoughts?
I am having exactly same issue. Any news or workarounds?