function readOnly(count){ }
Starting November 20, the site will be set to read-only. On December 4, 2023,
forum discussions will move to the Trailblazer Community.
+ Start a Discussion
Lightning UserLightning User 

Task Field Sets not working

Hi,

   I'm getting this error with this VF page :

ErrorError: Could not resolve the entity from <apex:outputField> value binding '{!Task[f]}'. outputField can only be used with SObject fields.

 

Can anyone help please? Thanks

 

<apex:page standardController="Task" showHeader="false">
    <apex:form >
      <apex:pageBlock title="New Task" mode="edit">
          <apex:pageBlockButtons location="top">
             <!-- <apex:commandButton onClick="{javascript&colon;window.close()}" value="Close this window"/> -->
             <apex:commandButton value="Save" action="{!save}"/>
          </apex:pageBlockButtons>
          <apex:pageBlockSection columns="2">
           <apex:repeat value="{!$ObjectType.Task.FieldSets.TaskNote_CTask}" var="f">
                <apex:outputField value="{!Task[f]}"/>      
           </apex:repeat>
          </apex:pageBlockSection>
      </apex:pageBlock>

    </apex:form>
</apex:page>

Best Answer chosen by Lightning User
MalgorzataMalgorzata
Not sure if the problem was already solved, it looks very old post. I would like to share how this problem was solved on our side.
I had the same issue for Account object. On one org, trying to save the line:
 <apex:repeat value="{!$ObjectType.Account.FieldSets.TestFieldSets}" var="fieldAPIName">                  
                   <apex:inputField value="{!Account[fieldAPIName]}" Required="False" />                                               
                </apex:repeat>                  
I was getting the error:
Error: Could not resolve the entity from <apex:inputField> value binding '{!Account[fieldAPIName]}'. <apex:inputField> can only be used with SObjects, or objects that are Visualforce field component resolvable.

In my case what solved the problem was to change the Salesforce.com API version settings to most recent one. On the first org the Salesforce.com API version was not migrated since a while, whether when I tried to reproduce the problem on another org by creating a brand new visualforce page with exactly the same code, in this case by default most recent Salesforce.com API version was used.
Maybe this might solve your problem too.
 

All Answers

mtbclimbermtbclimber

I just tested in my account and your code works fine. Can you get a new developer edition and try it there? If you need your current account to be investigated please log a support case.  It may be that your account doesn't have the dynamic binding feature enabled.

Lightning UserLightning User

Hmm, that is strange...I can get it to work for another org but not this one...Contact Field sets and Account field sets don't have any problems on either org.

mtbclimbermtbclimber

Hmm.That is interesting. Long shot and I don't know how it would come into play but do you happen to have an Apex class in your org named "Task"?

Lightning UserLightning User

No, but I have a visualforce page named Task. Is that bad?

mtbclimbermtbclimber

Shouldn't be. Apex class named "Task" had no impact on my copy of your sample but I can't always tell if a community member filtered some things out that have meaning :)

 

The only other thing I can think of here is something specific to your fieldset definition.  Can you try removing all fields from the fieldset but maybe "Subject" and then trying again. If that works then somehow a field in your fieldset is causing this. Let me know if you can ascertain which field caused the error if that's the case.

 

 

Lightning UserLightning User

Just tried, same error...

 

:(

MalgorzataMalgorzata
Not sure if the problem was already solved, it looks very old post. I would like to share how this problem was solved on our side.
I had the same issue for Account object. On one org, trying to save the line:
 <apex:repeat value="{!$ObjectType.Account.FieldSets.TestFieldSets}" var="fieldAPIName">                  
                   <apex:inputField value="{!Account[fieldAPIName]}" Required="False" />                                               
                </apex:repeat>                  
I was getting the error:
Error: Could not resolve the entity from <apex:inputField> value binding '{!Account[fieldAPIName]}'. <apex:inputField> can only be used with SObjects, or objects that are Visualforce field component resolvable.

In my case what solved the problem was to change the Salesforce.com API version settings to most recent one. On the first org the Salesforce.com API version was not migrated since a while, whether when I tried to reproduce the problem on another org by creating a brand new visualforce page with exactly the same code, in this case by default most recent Salesforce.com API version was used.
Maybe this might solve your problem too.
 
This was selected as the best answer
Lightning UserLightning User
Finally a solution! Thank you! :)