{"id":382,"date":"2014-02-18T13:21:42","date_gmt":"2014-02-18T13:21:42","guid":{"rendered":"http:\/\/www.greytrix.com\/blogs\/salesforce\/?p=382"},"modified":"2025-05-15T10:00:01","modified_gmt":"2025-05-15T10:00:01","slug":"using-same-component-multiple-times-in-a-visualforce-page","status":"publish","type":"post","link":"https:\/\/www.greytrix.com\/blogs\/salesforce\/2014\/02\/18\/using-same-component-multiple-times-in-a-visualforce-page\/","title":{"rendered":"Using same component multiple times in a Visualforce page"},"content":{"rendered":"<p>While working on a project, we created a component and had to use this component in the same page multiple times to show grid data for different objects. Here the JavaScript functions and variables were getting conflicted and the component was not referring to the correct JavaScript function and variables.<\/p>\n<p>To resolve this conflicting issue, we had to make the JavaScript Functions and variables dynamic as well.<\/p>\n<p>So, we created the unique <b>Id attribute <\/b>in the component and<b> <\/b>appended to JavaScript functions and variables so as to make them unique.<\/p>\n<p>The code snippet for Dynamic JavaScript Functions and Variables is as shown below &#8211;<\/p>\n<p><b>Apex Component:<\/b><a href=\"https:\/\/www.greytrix.com\/blogs\/salesforce\/wp-content\/uploads\/2014\/02\/snip1.png\"><img fetchpriority=\"high\" decoding=\"async\" class=\"aligncenter wp-image-385 size-full\" title=\"snip1\" src=\"https:\/\/www.greytrix.com\/blogs\/salesforce\/wp-content\/uploads\/2014\/02\/snip1.png\" alt=\"snip1\" width=\"630\" height=\"175\" \/><\/a><\/p>\n<p><b>Apex Page:<\/b><\/p>\n<p><b>\u00a0<\/b>Here is the code snippet to call the same component multiple times in the same visual force page &#8211;<a href=\"https:\/\/www.greytrix.com\/blogs\/salesforce\/wp-content\/uploads\/2014\/02\/snip2.png\"><img decoding=\"async\" class=\"aligncenter wp-image-386 size-full\" title=\"snip2\" src=\"https:\/\/www.greytrix.com\/blogs\/salesforce\/wp-content\/uploads\/2014\/02\/snip2.png\" alt=\"snip2\" width=\"624\" height=\"112\" \/><\/a><\/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=\"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<li><a title=\"Transaction aborted: timeout error in Salesforce\" href=\"https:\/\/www.greytrix.com\/blogs\/salesforce\/2014\/01\/14\/transaction-aborted-timeout-error-in-salesforce\/\" target=\"_blank\" rel=\"noopener\">Transaction aborted: timeout error in Salesforce<\/a><\/li>\n<\/ul>\n","protected":false},"excerpt":{"rendered":"<p>While working on a project, we created a component and had to use this component in the same page multiple times to show grid data for different objects. Here the JavaScript functions and variables were getting conflicted and the component was not referring to the correct JavaScript function and variables. To resolve this conflicting issue,\u2026 <span class=\"read-more\"><a href=\"https:\/\/www.greytrix.com\/blogs\/salesforce\/2014\/02\/18\/using-same-component-multiple-times-in-a-visualforce-page\/\">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":[2],"tags":[99],"class_list":["post-382","post","type-post","status-publish","format-standard","hentry","category-gumu-salesforce","tag-dynamic-component"],"_links":{"self":[{"href":"https:\/\/www.greytrix.com\/blogs\/salesforce\/wp-json\/wp\/v2\/posts\/382","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=382"}],"version-history":[{"count":4,"href":"https:\/\/www.greytrix.com\/blogs\/salesforce\/wp-json\/wp\/v2\/posts\/382\/revisions"}],"predecessor-version":[{"id":10757,"href":"https:\/\/www.greytrix.com\/blogs\/salesforce\/wp-json\/wp\/v2\/posts\/382\/revisions\/10757"}],"wp:attachment":[{"href":"https:\/\/www.greytrix.com\/blogs\/salesforce\/wp-json\/wp\/v2\/media?parent=382"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/www.greytrix.com\/blogs\/salesforce\/wp-json\/wp\/v2\/categories?post=382"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/www.greytrix.com\/blogs\/salesforce\/wp-json\/wp\/v2\/tags?post=382"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}