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
VijayNiVijayNi 

Error is in expression '{!case.Asset}' in component <apex:inputField>

Hi All,

I am  creating Vf page  while rendering the Vf page i am geting the below error .

Error is in expression '{!case.Asset}' in component <apex:inputField> in page newaccountpage

Asset is the Lookup filed for the case object

<apex:page standardController="case" >

<apex:form >
<apex:pageBlock >
<apex:pageBlockSection title="Case Details " collapsible="true">
<apex:inputField value="{!case.Subject}"/>
<apex:inputField value="{!case.CaseNumber}"/>
<apex:inputField value="{!case.Priority}"/>
<apex:inputfield value="{!case.Asset}"/>
</apex:pageBlockSection>
</apex:pageBlock>
</apex:form>
</apex:page>

Thanks,
Vijay.
Best Answer chosen by VijayNi
Maharajan CMaharajan C
HI Vijay,

Change the {!case.Asset}   ==> {!case.AssetId}

AssetId is the API Name for Asset field.
 
<apex:page standardController="case" >
    <apex:form >
        <apex:pageBlock >
            <apex:pageBlockSection title="Case Details " collapsible="true">
                <apex:inputField value="{!case.Subject}"/>
                <apex:inputField value="{!case.CaseNumber}"/>
                <apex:inputField value="{!case.Priority}"/>
                <apex:inputfield value="{!case.AssetId}"/>
            </apex:pageBlockSection>
        </apex:pageBlock>
    </apex:form>
</apex:page>

Thanks,
Maharajan.C

All Answers

Maharajan CMaharajan C
HI Vijay,

Change the {!case.Asset}   ==> {!case.AssetId}

AssetId is the API Name for Asset field.
 
<apex:page standardController="case" >
    <apex:form >
        <apex:pageBlock >
            <apex:pageBlockSection title="Case Details " collapsible="true">
                <apex:inputField value="{!case.Subject}"/>
                <apex:inputField value="{!case.CaseNumber}"/>
                <apex:inputField value="{!case.Priority}"/>
                <apex:inputfield value="{!case.AssetId}"/>
            </apex:pageBlockSection>
        </apex:pageBlock>
    </apex:form>
</apex:page>

Thanks,
Maharajan.C
This was selected as the best answer
VijayNiVijayNi
Hi Maharajan,

Thanks it worked fine  when i checked on the object the filed name showed as Asset.
Can you help me how to know the API name in salesforce .

User-added image

Thanks,
Vijay.


 
Maharajan CMaharajan C
This confusion will come only for standard Fields Vijay. For custom fields you can refer it from the Object Manager.

Case Object Standard Fields you can refer the below documnet.

https://developer.salesforce.com/docs/atlas.en-us.object_reference.meta/object_reference/sforce_api_objects_case.htm


Thanks,
Maharajan.C