{"id":411,"date":"2014-03-01T12:30:10","date_gmt":"2014-03-01T12:30:10","guid":{"rendered":"http:\/\/www.greytrix.com\/blogs\/salesforce\/?p=411"},"modified":"2025-05-15T10:03:14","modified_gmt":"2025-05-15T10:03:14","slug":"dynamic-file-name-for-exported-pdf","status":"publish","type":"post","link":"https:\/\/www.greytrix.com\/blogs\/salesforce\/2014\/03\/01\/dynamic-file-name-for-exported-pdf\/","title":{"rendered":"Dynamic File Name for Exported PDF"},"content":{"rendered":"<p>Earlier we had posted a couple of blogs on the export features in Salesforce. They are <a title=\"Excel Export in Salesforce\" href=\"https:\/\/www.greytrix.com\/blogs\/salesforce\/excel-export-in-salesforce\/\" target=\"_blank\" rel=\"noopener\">Excel Export in Salesforce<\/a> and <a title=\"PDF Export in Salesforce\" href=\"https:\/\/www.greytrix.com\/blogs\/salesforce\/pdf-export-in-salesforce\/\" target=\"_blank\" rel=\"noopener\">PDF Export in Salesforce<\/a>. In these blogs, we have provided information on how to export the data in Excel and PDF format.<\/p>\n<p>While exporting the data to pdf or Excel format some name is assigned to the exported file by default. As an alternative to this, we can dynamically set the file name that needs to be exported.<\/p>\n<p>To achieve this, we created a property called FileName in the controller as shown below &#8211;<a href=\"https:\/\/www.greytrix.com\/blogs\/salesforce\/wp-content\/uploads\/2014\/03\/cont1.jpg\"><img fetchpriority=\"high\" decoding=\"async\" class=\"aligncenter wp-image-412 size-full\" title=\"cont1\" src=\"https:\/\/www.greytrix.com\/blogs\/salesforce\/wp-content\/uploads\/2014\/03\/cont1.jpg\" alt=\"cont1\" width=\"413\" height=\"188\" \/><\/a>Then we set FileName value through visualforce page using Javascript code as highlighted in below screenshot &#8211;<a href=\"https:\/\/www.greytrix.com\/blogs\/salesforce\/wp-content\/uploads\/2014\/03\/cont2.jpg\"><img decoding=\"async\" class=\"aligncenter wp-image-413 size-full\" title=\"cont2\" src=\"https:\/\/www.greytrix.com\/blogs\/salesforce\/wp-content\/uploads\/2014\/03\/cont2.jpg\" alt=\"cont2\" width=\"860\" height=\"423\" \/><\/a>We then add FileName property to the contentType attribute of apex:page tag as shown below &#8211;<a href=\"https:\/\/www.greytrix.com\/blogs\/salesforce\/wp-content\/uploads\/2014\/03\/cont3.jpg\"><img decoding=\"async\" class=\"aligncenter wp-image-414 size-full\" title=\"cont3\" src=\"https:\/\/www.greytrix.com\/blogs\/salesforce\/wp-content\/uploads\/2014\/03\/cont3.jpg\" alt=\"cont3\" width=\"778\" height=\"303\" \/><\/a><\/p>\n<p>Using the above approach, we can dynamically set the file name to be used when exporting files in any supported format.<\/p>\n<p><span style=\"font-size: Medium;\"><strong>About Us<\/strong><\/span><br \/>\n<a href=\"https:\/\/www.greytrix.com\/\">Greytrix<\/a> as a Salesforce Product development partner offers a wide variety of integration products and services to the end users as well as to the Partners across the globe. We offers Consultation, Configuration, Training and support services in out-of-the-box functionality as well as customizations to incorporate custom business rules and functionalities that requires apex code incorporation into the Salesforce platform.<\/p>\n<p><a href=\"https:\/\/www.greytrix.com\/\">Greytrix<\/a> has some unique solutions for Cloud CRM such as Salesforce integration with <a href=\"https:\/\/www.greytrix.com\/product\/sage-x3\/gumu-x3-salesforce-integration\">Sage Enterprise Management (Sage X3<\/a>), Sage Intacct, <a href=\"https:\/\/www.greytrix.com\/product\/sage-100-erp\/gumu-100-salesforce-integration\">Sage 100 <\/a>and <a href=\"https:\/\/www.greytrix.com\/product\/sage-300-erp\/gumu-300-salesforce-integration\">Sage 300 (Sage Accpac)<\/a>. We also offer best-in-class Cloud CRM <a href=\"https:\/\/www.greytrix.com\/product\/crm-development\/salesforce-com\">Salesforce customization and development services<\/a> along with services such as Salesforce <a href=\"https:\/\/www.greytrix.com\/product\/professional-services\/data-migration-services\">Data Migration<\/a>, <a href=\"https:\/\/www.greytrix.com\/product\/professional-services\/integrated-application-development\">Integrated App development<\/a>, <a href=\"https:\/\/www.greytrix.com\/product\/professional-services\/custom-development\">Custom App development<\/a> and <a href=\"https:\/\/www.greytrix.com\/product\/professional-services\/maintenance-support\">Technical Support<\/a> to business partners and end users.<\/p>\n<p>Greytrix GUMU&#x2122; integration for Sage ERP \u2013 Salesforce is a 5-star app listed on <a href=\"https:\/\/appexchange.salesforce.com\/listingDetail?listingId=a0N30000000psM5EAI\" target=\"_blank\" rel=\"noopener\">Salesforce AppExchange<\/a>.<\/p>\n<p>For more information, please contact us at <a href=\"mailto:salesforce@greytrix.com\">salesforce@greytrix.com<\/a>. We will be glad to assist you.<\/p>\n<p><strong><span style=\"font-size: Medium;\">Related Posts<\/span><\/strong><\/p>\n<ul>\n<li><a title=\"Using same component multiple times in a Visualforce page\" href=\"https:\/\/www.greytrix.com\/blogs\/salesforce\/2014\/02\/18\/using-same-component-multiple-times-in-a-visualforce-page\/\" target=\"_blank\" rel=\"noopener\">Using same component multiple times in a Visualforce page<\/a><\/li>\n<li><a style=\"line-height: 1.6em;\" title=\"Editing the page link for Visualforce Tab\" href=\"https:\/\/www.greytrix.com\/blogs\/salesforce\/2014\/02\/18\/editing-the-page-link-for-visualforce-tab\/\" target=\"_blank\" rel=\"noopener\">Editing the page link for Visualforce Tab<\/a><\/li>\n<li><a title=\"Overlapping issue in Salesforce App Menu\" href=\"https:\/\/www.greytrix.com\/blogs\/salesforce\/2014\/02\/06\/overlapping-issue-in-salesforce-app-menu\/\" target=\"_blank\" rel=\"noopener\">Overlapping issue in Salesforce App Menu<\/a><\/li>\n<li><a title=\"Set controller variable\/properties from JavaScript\" href=\"https:\/\/www.greytrix.com\/blogs\/salesforce\/2014\/02\/04\/set-controller-variableproperties-from-javascript\/\" target=\"_blank\" rel=\"noopener\">Set controller variable\/properties from JavaScript<\/a><\/li>\n<li><a title=\"Number of Retries for JSRemote Call\" href=\"https:\/\/www.greytrix.com\/blogs\/salesforce\/2014\/01\/16\/number-of-retries-for-jsremote-call\/\" target=\"_blank\" rel=\"noopener\">Number of Retries for JSRemote Call\u00a0<\/a><\/li>\n<\/ul>\n","protected":false},"excerpt":{"rendered":"<p>Earlier we had posted a couple of blogs on the export features in Salesforce. They are Excel Export in Salesforce and PDF Export in Salesforce. In these blogs, we have provided information on how to export the data in Excel and PDF format. While exporting the data to pdf or Excel format some name is\u2026 <span class=\"read-more\"><a href=\"https:\/\/www.greytrix.com\/blogs\/salesforce\/2014\/03\/01\/dynamic-file-name-for-exported-pdf\/\">Read More &raquo;<\/a><\/span><\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"closed","ping_status":"closed","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[3],"tags":[571,100,121,258],"class_list":["post-411","post","type-post","status-publish","format-standard","hentry","category-salesforce-srv","tag-dynamic-file-in-salesforce","tag-dynamic-filename","tag-excel-export","tag-pdf-export"],"_links":{"self":[{"href":"https:\/\/www.greytrix.com\/blogs\/salesforce\/wp-json\/wp\/v2\/posts\/411","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/www.greytrix.com\/blogs\/salesforce\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/www.greytrix.com\/blogs\/salesforce\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/www.greytrix.com\/blogs\/salesforce\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/www.greytrix.com\/blogs\/salesforce\/wp-json\/wp\/v2\/comments?post=411"}],"version-history":[{"count":3,"href":"https:\/\/www.greytrix.com\/blogs\/salesforce\/wp-json\/wp\/v2\/posts\/411\/revisions"}],"predecessor-version":[{"id":10759,"href":"https:\/\/www.greytrix.com\/blogs\/salesforce\/wp-json\/wp\/v2\/posts\/411\/revisions\/10759"}],"wp:attachment":[{"href":"https:\/\/www.greytrix.com\/blogs\/salesforce\/wp-json\/wp\/v2\/media?parent=411"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/www.greytrix.com\/blogs\/salesforce\/wp-json\/wp\/v2\/categories?post=411"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/www.greytrix.com\/blogs\/salesforce\/wp-json\/wp\/v2\/tags?post=411"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}