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
InternalServerErrorInternalServerError 

Display Asset name from case standard controller.

 

There is a standard field Asset (a lookup) in the case object. I am trying to display the name of the asset on the VF page using standard controller. This works for any other field but not for the asset name

 

{!case.AssetId} > returns ID

{!case.Asset.Name} > returns nothing 

 

What am I missing?

 

Thanks.

Best Answer chosen by Admin (Salesforce Developers) 
AravindBabu512AravindBabu512

Hi

 

Did you try the same once, when i tried, i get the Asset name only when I show it in the screen as an output field. I again verified it with Account, it displayed the name and not the ID.

 

In the below, both Account and Asset Id displayed the names respectively with the standard controller as CASE.

 

<apex:outputField id="CaseField1" value="{!Case.CaseNumber}"/>
<apex:outputField id="CaseField2" value="{!Case.AccountId}"/>
<apex:outputField id="CaseField3" value="{!Case.AssetId}"/>

 

All Answers

AravindBabu512AravindBabu512

Hi

 

Did you try the same once, when i tried, i get the Asset name only when I show it in the screen as an output field. I again verified it with Account, it displayed the name and not the ID.

 

In the below, both Account and Asset Id displayed the names respectively with the standard controller as CASE.

 

<apex:outputField id="CaseField1" value="{!Case.CaseNumber}"/>
<apex:outputField id="CaseField2" value="{!Case.AccountId}"/>
<apex:outputField id="CaseField3" value="{!Case.AssetId}"/>

 

This was selected as the best answer
InternalServerErrorInternalServerError

I forgot to mention that this is a customer portal user (high volume customer portal)

InternalServerErrorInternalServerError

Thanks Aravind. The problem was that the page was calling the field just like this {!Case.AssetId}, when I put that inside the outputfield it worked.