I am trying to create a printable packing slip via visualforce page in a button on the case object.

I've created the button and everything seems to be working fine UNTIL I try to reference fields on the account. Is there a way to reference the related account (lookup on the case) fields, such as shipping address?

Can this be done with ONLY using the standard controller? Because I know next-to-nothing about controllers, controller extensions, etc. and the documentation might as well be a foreign language... (I'm a visualforce noob...)

Here is my visualforce page...

<apex:page showheader="false" sidebar="false" standardController="Case">
<apex:variable value="{!Case}" var="c" />
    window.onload = function() { 
    @media print{
            font-size: medium;
            font-size: medium;
</style><br /><br />
    <apex:outputField value="{!c.Account.Name}"/><br />
    <apex:outputField value="{!c.Account.ShippingAddress}"/><br />
    Item(s) shipped on <apex:outputField value="{!c.Shipped_On__c}"/><br />


  • did you try eliminating the apex:variable and using merge fields {!Case.account.name} etc. ?
    – cropredy
    Nov 10, 2015 at 21:04
  • I have not tried eliminating the variable, but the Account.Name is populating fine. It's the additional fields, specifically Account.Shipping address that I'm having trouble with...
    – BeckBeck
    Nov 11, 2015 at 21:26
  • this is addressed here: stackoverflow.com/questions/19559475/…
    – cropredy
    Nov 11, 2015 at 21:32
  • Thank you! Embarrassed I didn't think to do that on my own. Again, thanks!
    – BeckBeck
    Nov 19, 2015 at 16:43

2 Answers 2


The problem you seem to be having is that the field Account.ShippingAddress won't render on the VF page because it is a compound field

Instead, reference the individual fields


Standard controller do not bring data from related records directly. So, the best way will be to use controller extensions to pull account details and display on VF Page.

However, as you stated you don't want to go via Apex route, then the alternative (not highly recommended) I can think of is to create custom fields on case to store account field information and create workflow/ lightning process to populate these fields. So, on creation/ updation of case, it can pull data from account fields. Once the case fields are populated, you can very well use them to display data within visualforce page

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .