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
nothingisreal68nothingisreal68 

Dynamic Visualforce Bindings Working In One Org and not Another

 

I have a visualforce component utilizing dynamic bindings that I would like to use in multiple orgs. Everything works great in one org, but when I move it to another, I receive the following message after the component attempts to rerender itself:

 

Could not resolve the entity from <apex:inputField> value binding '{!obj[fieldName]}'. inputField can only be used with SObject fields.

 

 

The code is as follows:

 

<apex:inputField value="{!obj[fieldName]}" rendered="{!obj[fieldName] != otherValue && obj[fieldName] !=otherMessage}"> 

<apex:actionSupport event="onchange" reRender="thePanel" action="{!processSelection}" status="status" / >

</apex:inputField>

 

 

"obj" is a reference to a generic sObject in the controller, and "fieldName" is a String in the controller.

 

I find it interesting that the visualforce page compiles and saves, and that it only throws this error when it attempts to reRedner. I checked to ensure that the API version of the page the component is on, the component itself, and the component controller is the same in both orgs. 

 

Thanks in advance for any insight!

aballardaballard

Is the fieldname valid and the field accessible to the user in the org where it doesn't work?

 

nothingisreal68nothingisreal68

Aballard,

 

The field name is valid and I am the system administrator, so I should have access. I checked my profile and I have access to the object, access to the field in FLS, and access to the Apex Controller. 

 

Another reason why I know the fieldname is valid is that when the page first loads, the inputField renders the selectList with the correct options as expected. It is only when the component reRenders that I get this message. 

Shashikant SharmaShashikant Sharma

It seems to me a namespace issue.The org where it is not working must have installed a managed package with namespace.

nothingisreal68nothingisreal68

Shashikant,

 

It seems to me that both orgs have installed many managed packages. If this is a namespace issue, how can I resolve this? None of my classes or pages reference any managed packages.

aballardaballard

Does either the org where it works or the one where it doesn't have its own namespace?

nothingisreal68nothingisreal68

The org where the code does work has its own namespace, i.e. namespace.cs3.my.salesforce.com..... The org where the code does not work does not have a namespace. However, I do not reference any namespace in any code. I recreated the necessary clases and pages and copied the code over manually, I did not use a package of any kind. 

nothingisreal68nothingisreal68

So now that I know that one org has a namespace and the other does not, how do I fix this issue in the org without a namespace?

aballardaballard

You may have to enter a support case... nothing obvious here.