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
Manpreet Singh 13Manpreet Singh 13 

Need help with simple visualforce page

Dear All,

I am creating a visualforce page which opens when we click on a 'Custom' button (/apex/CaseDetail?CaseId={!Case.Id}) placed on Case detail page. I am not able to pass the Account Name of the record into this custom page. 

Below mentioned is the code - I am sure there is some issue with the code..

<apex:page showHeader="false" sidebar="false" standardController="Case">
  <apex:form >
    <apex:pageBlock title="Case Details" mode="maindetail">
    
    <apex:pageBlockButtons location="top">
            <apex:CommandButton value="Print" onclick="javascript:window.print(); return false"/>
            <apex:CommandButton value="Close" onclick="window.close(); return false;"/>
    </apex:pageBlockButtons>
    
    <apex:pageBlockSection id="CaseSumary" columns="3" title="Case Summary" collapsible="true">
          
          <apex:pageBlockSectionItem >
          <apex:outputPanel >
                   <apex:outputLabel value="Account Name:" for="account"/>
                   <apex:outputField id="type" value="{!Case.AccountId}"/>
          </apex:outputPanel> 
          </apex:pageBlockSectionItem>
                                          
     </apex:pageBlockSection>
      
    </apex:pageBlock>
  </apex:form>
</apex:page>


And here is the screenshot of visual force page. You can see that I am not able to get value of the account record.

User-added image

Thanks,
Manpreet Singh
Best Answer chosen by Manpreet Singh 13
Rajiv Bhatt 16Rajiv Bhatt 16
The URL of the custom button should have the paramter of Id instead of CaseId. Please update it to /apex/CaseDetail?Id={!Case.Id} and try again

All Answers

Rajiv Bhatt 16Rajiv Bhatt 16
The URL of the custom button should have the paramter of Id instead of CaseId. Please update it to /apex/CaseDetail?Id={!Case.Id} and try again
This was selected as the best answer
PratikPratik (Salesforce Developers) 
Hi Manpreet,

In the url, insted of Caseid put only id.

https://pratikmuno-dev-ed--pmunotdev.ap1.visual.force.com/apex/casesummary?id=5009000000CetFF

I just tried and it's working.

Thanks,
Pratik
Ashish_Sharma_DEVSFDCAshish_Sharma_DEVSFDC
Hi Manpreet,

Use Case.Account.Name to get name .
<apex:outputField id="type" value="{!Case.Account.Name}"/>

Let us know if it helps.
 
Sagar PareekSagar Pareek
Hi Manpreet,

Do this Case have any account assigned to it? I guess this case is not having account associated with it.

Also you are refereing the AccountId field which will show accountId not the Account Name . You will need to use a extension with your page that will pull out the account name based on the accountId. 
PratikPratik (Salesforce Developers) 
Hi Ashish,

Even Case.Accountid will show account name.

Thanks,
Pratik
Manpreet Singh 13Manpreet Singh 13
Hello All, Thank you for your responses. In fact, /apex/CaseDetail?Id={!Case.Id} worked. I may come back to the same thread with few more queries :)
Manpreet Singh 13Manpreet Singh 13
Dear All,

Quick question, this is in continuation to previous thread. I want to bring few selected fields on visual force page from related list of case record. Example

1) Emails - To, CC, BCC, Email Body
2) Open Activities - Created By, Assigned To, Subject, Comment, Status

Basically, I am trying to build custom Printable view but with better and less clutered UI. So, need details of every record under emails, Open Activities etc.Till now, I am using Standard Case Controller.

Thanks,
Manpreet Singh