+ Start a Discussion
BomanBoman 

Invalid field TextName for SObject Account - appearing since weekend Spring'11 upgrade

Anyone else seeing this?

 

Occurs on "Edit" of Account that has the Edit button overridden to bring up an AccountEditVFPage.

 

Debug logs shows no error!

 

Ideas?

Best Answer chosen by Admin (Salesforce Developers) 
BomanBoman

Solved!

 

Spring'11 does not like the Name field being referenced on a VF page when isPersonAccount is TRUE. My doing so exposed a bug in SFDC.

 

Workaround for me is to conditionally render Name only if isPersonAccount = FALSE.

All Answers

kyle.tkyle.t

search your visualforce page for "TextName" and see if it appears.  the error is saying that you have a field called TextName in the code and when it tries to run the VFPage, Salesforce can't find that field.

BomanBoman

There is no field by the name "TextName" anywhere in my code base.

 

And, this code has been untouched since months. Suddenly starts showing this error (right after Spring'11).

 

Thanks, anyways...

 

--Boman.

kyle.tkyle.t

does the VF page have a custom controller? doubting the issue lies in there, but worth looking.

BomanBoman

Of course. The Debug Log shows the controller constructor code being executed error-free.

kyle.tkyle.t

I am fresh out of ideas then... good luck.

BomanBoman

Solved!

 

Spring'11 does not like the Name field being referenced on a VF page when isPersonAccount is TRUE. My doing so exposed a bug in SFDC.

 

Workaround for me is to conditionally render Name only if isPersonAccount = FALSE.

This was selected as the best answer
Mats ErikssonMats Eriksson

Great!

 

Solved my problem quite nicely! Thx for posting your solution.

 

/Mats

SalesRedSalesRed

Hi Boman,  I have encountered this issue also.  Do you know if it is only Spring 11 that encounters this issue?  Does it occur on newer versions also?

 

Thanks.

pvisonepvisone

I'm new to Visualforce and am going through the tutorial in the developer's guide.  I also keep getting this error when I try to write this simple example.  We are using Person Accounts so the solution suggested seem related.  Where do put PersonAccount=FALSE?  Thank you!

 

<apex:page standardController="Account">
<apex:form>
<apex:pageBlock title="Hello {!$User.FirstName}!">
You are viewing the {!account.name} account. <p/>
Change Account Name: <p/>
<apex:inputField value="{!account.name}"/> <p/>
<apex:commandButton action="{!save}" value="Save New Account Name"/>
</apex:pageBlock>
</apex:form>
</apex:page>

Mats ErikssonMats Eriksson

@pvisone If you want to change the name of a Person Account, change the First name and Last Name fields separately. On your page you need to check if your account is a person Account through the flag IsPersonAccount. This flag is not found on the Fields Page but it is there nonethless on the Account.

 

You can check the flag through the "Rendered" parameter on the PageBlock like this:

 

<apex:page standardController="Account">
<apex:form >
<apex:pageBlock title="Hello {!$User.FirstName}!" rendered="{!(!account.IsPersonAccount)}"> <!-- If it is NOT a Person Account, display this page block -->
You are viewing the {!account.name} account. <p/>
Change Account Name: <p/>
<apex:inputField value="{!account.name}"/> <p/>
<apex:commandButton action="{!save}" value="Save New Account Name"/>
</apex:pageBlock>
<apex:pageBlock title="Hello {!$User.FirstName}!" rendered="{!account.IsPersonAccount}"> <!-- If it IS a person account, display First Name + Last Name for editing instead! -->
Change Person Account Name: <p/>
<apex:inputField value="{!account.FirstName}"/> <p/>
<apex:inputField value="{!account.LastName}"/> <p/>
<apex:commandButton action="{!save}" value="Save New Person Account Name"/>
</apex:pageBlock>
</apex:form>
</apex:page>

 

 

Good luck

 

/Mats

pvisonepvisone

That explains it.  Thank you!  Is there a resource for all the possible parameters for each component attribute?

Mats ErikssonMats Eriksson

You should out this manual:

 

Visualforce Developer's Guide

 

Go to section "Standard Component Reference" to see all Visualforce components and their usage.

 

Cheers

 

/Mats