+ Start a Discussion
Steve ChadbournSteve Chadbourn 

Summer 08 Ate My Hamster

Not my hamster actually but my formula fields.
 
Our dev sandbox has just had some sort of Summer 08 upgrade. I'm guessing this as all my pages now declare themselves to be API 13.0. I had to open and save all my VF pages before Eclipse could see them.
 
I tried to run my first page and got the error: "An internal server error has occurred". By a process of removing and adding components I narrowed it down to 3 formula fields. 2 no longer display anything. The third causes the internal server error. What heinous act does the formula field try and do I hear you ask? it has one line of code:
 
NOW()
 
The page uses an outputField to display the formula field.
 
Is anyone else having the same problem?
dchasmandchasman
To be clear - the issue you are seeing is with custom formula fields not just a page formula like {!now()}? One reason I ask is to find out if you are using custom formula fields for something that could be easily and less expensively achieved via a formula directly in the page.

Not sure about the issue with Eclipse - the force.com ide plugin is not owned or developed by the visualforce team.


Message Edited by dchasman on 05-21-2008 06:46 PM
Steve ChadbournSteve Chadbourn
Thanks for replying Doug.
 
There are 2 issues here - the first is the best place to put the formula field. The second is the problem with custom formula fields and Summer 08.
 
On the first issue - I started out using a page formula like you suggested. It didn't display quite like I wanted:
 
Wed May 21 23:02:09 GMT 2008
 
I discovered that if I used a custom formula field the outputField formatted it quite nicely:
 
22/05/2008 10:45
 
The other benefit of using a custom formula field was one of centralisation - I do other things with the field such as saving it in a new object. If I decide to apply different formatting it is all in one place.
 
On the second issue yes it is custom formula fields that Summer 08 seems to have a problem with. I have another custom formula field that has simple contents:
 
$User.FirstName & ' ' & $User.LastName
 
This one displays fine pre Summer 08 but does not display anything at all post Summer 08.
 
 
 
dchasmandchasman
All the right answers on why to use formula fields - just wanted to be sure because there have been lots of cases where folks are using formula fields as a hammer.

Does your formula field $User.FirstName & ' ' & $User.LastName display correctly when used in a page layout?
Steve ChadbournSteve Chadbourn

I don't have an easy way of testing that. The field is against an object that is only ever temporary - it provides databinding for a wizard.

This works:

<apex:outputText value="{!$User.FirstName}"/>

Is there a way I can concatenate the firstname and lastname together here? This _is_ one instance where I could use a page formula rather than a field formula but I never figured out how to concatenate stuff together on the page which is why I uses the field formula in this case. Something like:
 
<apex:outputText value="{!$User.FirstName + ' ' + $User.LastName }"/>
 
 

 

Steve ChadbournSteve Chadbourn

<fx: Slaps head>

Of course its this:

<apex:outputText value="{!$User.FirstName} {!$User.LastName}"/>

But better implemented as this:
 
// page
<apex:outputText value="{!Username}"/>

// controller
public string getUsername()
{
return UserInfo.getName();
}


 
Steve ChadbournSteve Chadbourn

I can report that formula fields do work on page layouts, just not on VF pages.

I have a formula field Contact.FullAddress__c which contains:

MailingStreet
& IF( MailingCity = "", "", ", " & MailingCity )  
& IF( MailingPostalCode = "", "", ", " & MailingPostalCode )

This appears fine if I put it on the Contact layout but returns nothing if I put it on a VF page.

Has this been identified as a bug?

TehNrdTehNrd
Are you using a custom or standard controller?

If it is a custom controller are you pulling all the contact fields that are used in this formula field for the contact object.

I don't know if this would make a difference but I'm just bouncing ideas around.
Steve ChadbournSteve Chadbourn

Thanks for the ideas.

I'm using a custom controller. I'm filling an array with contact objects I create then displaying it in a pageblocktable.

I have 2 sandboxes - one on Spring 08 and one on Summer 08. It works fine on Spring but is blank in Summer.