You need to sign in to do that
Don't have an account?
Erica Thomas
Creating Export to Excel Button on Related List using Visualforce Page
Hi All,
I am new at this, so please bare with me. I am trying to create a custom Export to Excel button that would appear on our Account related list "Agency Planning". I am receiving the syntax error: "Error: Export_to_Excel line 4, column 71: Element type "apex:pageblocktable" must be followed by either attribute specifications, ">" or "/>"
I ended line 4 with ">" but the error is still appearing. Any help would be great!
<apex:page standardController="Account" contentType="application/vnd.ms-excel">
<apex:relatedList="Agency_Planning__c">
<apex:pageBlock title="Agency Planning">
<apex:pageBlockTable value="{!Account.Agency_Planning__c}"var="Agency_Planning__c">
<apex:column value="{!Agency_Planning__c.Accounting_Month}">
<apex:column value="{!Agency_Planning__c.Planned_New_Business_Commission}"/>
<apex:column value="{!Agency_Planning__c.Actual_New_Business_Commission}"/>
<apex:column value="{!Agency_Planning__c.Over_Under}"/>
</apex:pageBlockTable>
</apex:pageBlock>
</apex:relatedList>
</apex:page>
Thanks!
Erica
I am new at this, so please bare with me. I am trying to create a custom Export to Excel button that would appear on our Account related list "Agency Planning". I am receiving the syntax error: "Error: Export_to_Excel line 4, column 71: Element type "apex:pageblocktable" must be followed by either attribute specifications, ">" or "/>"
I ended line 4 with ">" but the error is still appearing. Any help would be great!
<apex:page standardController="Account" contentType="application/vnd.ms-excel">
<apex:relatedList="Agency_Planning__c">
<apex:pageBlock title="Agency Planning">
<apex:pageBlockTable value="{!Account.Agency_Planning__c}"var="Agency_Planning__c">
<apex:column value="{!Agency_Planning__c.Accounting_Month}">
<apex:column value="{!Agency_Planning__c.Planned_New_Business_Commission}"/>
<apex:column value="{!Agency_Planning__c.Actual_New_Business_Commission}"/>
<apex:column value="{!Agency_Planning__c.Over_Under}"/>
</apex:pageBlockTable>
</apex:pageBlock>
</apex:relatedList>
</apex:page>
Thanks!
Erica
This is still not correct for me.This should be syntax as per my assumption try midfying the relationship and field name if they are not correct:-
If this helps,please mark it as best answer to help others :)
All Answers
Hope this resolves your issue!
Thanks for the quick reply! I added the foward slash, but am still receiving the error. Is there anything else in my code that could cause it?
<apex:page standardController="Account" contentType="application/vnd.ms-excel">
<apex:relatedList="Agency_Planning__c">
<apex:pageBlock title="Agency Planning">
<apex:pageBlockTable value="{!Account.Agency_Planning__c}"var="Agency_Planning__c">
<apex:column value="{!Agency_Planning__c.Accounting_Month}"/>
<apex:column value="{!Agency_Planning__c.Planned_New_Business_Commission}"/>
<apex:column value="{!Agency_Planning__c.Actual_New_Business_Commission}"/>
<apex:column value="{!Agency_Planning__c.Over_Under}"/>
</apex:pageBlockTable>
</apex:pageBlock>
</apex:relatedList>
</apex:page>
Your syntax does not seem to be correct for me ,here is one sample code :-
so pageblock table value should be "{!account.<Relationship Name>}"
Apex:Column value should be "{!<var>.<fieldname>}"
Go ahead modify the code as per it and you are good to go :)
If this helps,please mark it as best answer to help others :)
<apex:page standardController="Account" contentType="application/vnd.ms-excel">
<apex:pageBlock title="Agency Planning">
<apex:pageBlockTable value="{!account.<Agency_Planning__c>}" var="Agency_Planning__c">
<apex:column value="{!<Agency_Planning__c>.<Accounting_Month>}"/>
<apex:column value="{!<Agency_Planning__c>.<Planned_New_Business_Commission>}"/>
<apex:column value="{!<Agency_Planning__c>.<Actual_New_Business_Commission>}"/>
<apex:column value="{!<Agency_Planning__c>.<Over_Under>}"/>
</apex:pageBlockTable>
</apex:pageBlock>
</apex:page>
Thanks!
This is still not correct for me.This should be syntax as per my assumption try midfying the relationship and field name if they are not correct:-
If this helps,please mark it as best answer to help others :)
Thank you so much for your help! That worked! I really appreciate it. I'm new to apex and was having so much difficulty understanding what I was doing wrong. Thanks again!
The code is below. I used it to create a visualforce page that I then referenced in my custom Export to Excel button.
<apex:page standardController ="OnePlace__Function__c" contentType="application/vnd.ms-excel">
<apex:pageBlock title="Invitees">
<apex:pageBlockTable value="{!OnePlace__Function.OnePlace__Invitee__r}" var="item">
<apex:column value="{!item.Name}"/>
<apex:column value="{!item.Initial_Contact__c}"/>
<apex:column value="{!item.Investor_Contact__c"/>
<apex:column value="{!item.NDA_Sent__c}"/>
</apex:pageBlockTable>
</apex:pageBlock>
</apex:page>
When Saving I am getting an error;
Error: Unknown property 'OnePlace__Function__cStandardController.OnePlace__Function'
I am new to VF, thank you for helping!
I have similar requirement, let me know if its correct.
I am not able to view VF page as content in List Button.
Here is my Code
<apex:page standardController="Account" extensions="AccountPage" contentType="application/vnd.ms-excel#SalesForceExport.xls">
<apex:pageBlock title="Opportunities">
<apex:pageBlockTable value="{!account.Opportunities}" var="item"> //Plural Name
<apex:column value="{!item.Name}"/>
<apex:column value="{!item.StageName}"/>
<apex:column value="{!item.Type}"/>
</apex:pageBlockTable>
</apex:pageBlock>
</apex:page>
Thanks,
Kaushik
Hi Kaushik,
In order to add it to the related list, the VF page has to be a standard list controller.
Please see the following: https://developer.salesforce.com/docs/atlas.en-us.pages.meta/pages/pages_controller_sosc_custom_button.htm?search_text=list%20button
With that, I have another issue. When I perform the export it attempts to export all the opportunities in the org, not just the ones on the related list.
I have the following code:
All help is appreciated.
Thanks,
Javier