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" />
<script>
window.onload = function() {
window.print();
}
</script>
<style>
@media print{
h1{
font-size:x-large;
}
p{
font-size: medium;
}
table{
font-size: medium;
}
}
</style><br /><br />
<p>
<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 />
</p>
</apex:page>
Thanks!
Best Answer
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 fieldInstead, reference the individual fields