{"id":282,"date":"2020-05-07T08:00:32","date_gmt":"2020-05-07T08:00:32","guid":{"rendered":"https:\/\/www.techcrm.in\/blogs\/?p=282"},"modified":"2020-09-08T14:51:15","modified_gmt":"2020-09-08T09:21:15","slug":"how-to-call-javascript-function-from-editviewdefs-field-of-any-module-in-sugarcrm-suitecrm","status":"publish","type":"post","link":"https:\/\/www.techcrm.in\/blogs\/how-to-call-javascript-function-from-editviewdefs-field-of-any-module-in-sugarcrm-suitecrm\/","title":{"rendered":"How to call JavaScript function from editviewdefs field of any module in SugarCRM \/ SuiteCRM"},"content":{"rendered":"\n<p>It will be done by below steps only! Lets do this,<\/p>\n\n\n\n<p><strong>STEP 1 :<\/strong> Add a reference to the JavaScript file which will be needed for event binding.<\/p>\n\n\n\n<p><strong>Path:<\/strong>\u00a0custom\/modules\/&lt;desired_module>\/metadata\/editviewdefs.php<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>&lt;?php\n\n$viewdefs&#91;'&lt;desired_module>']&#91;'EditView']&#91;'templateMeta']&#91;'includes'] =\n    array (\n        array (\n        'file' => 'custom\/modules\/&lt;desired_module>\/js\/editview.js',\n        ),\n    );\n?><\/code><\/pre>\n\n\n\n<p><strong>Step 2 :<\/strong>  Add the JavaScript file you want to include into the location you referenced above(custom\/modules\/&lt;desired_module>\/js\/editview.js).<\/p>\n\n\n\n<p><strong>Step<\/strong> <strong>3<\/strong> <strong>:<\/strong> Write your custom function code in editview.js file.<\/p>\n\n\n\n<p><strong>Step 4 :<\/strong> Now the filed in which you want to call the JavaScript function write as follow<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>   0 =>  \n          array ( \n            'name' => 'fieldname', \n            'studio' => 'visible', \n            'label' => 'LBL_', \n            'displayParams' => \n           array ( \n             'javascript' => 'onchange=functionname()', \n           ),  \n          ), \n\n                                    or\n\n  0 =>  \n          array ( \n            'name' => 'fieldname', \n            'studio' => 'visible', \n            'label' => 'LBL_', \n            'displayParams' => \n           array ( \n                  'field'=>\n                  array(\n                         'onclick' => 'functionname();', \n                 ),\n           ),  \n          ), <\/code><\/pre>\n\n\n\n<p><strong>Step 4 :  <\/strong>Quick Repair, then hard refresh your browser. All Done ! <\/p>\n\n\n\n<p><strong>Step 5 : <\/strong>Done! Refresh the page and start testing.<strong> <\/strong><\/p>\n\n\n\n<blockquote class=\"wp-block-quote is-layout-flow wp-block-quote-is-layout-flow\"><p><strong>Note :<\/strong><\/p><cite><em>1. Read the comments in code carefully and replace the variables as asked.<br>2. Here, &lt;desired_module> means the module name you see in the URL, for example, Contacts, Leads, Accounts, etc.<br>3. You may find the field names and its labels in Admin > Studio > &lt;Your_module> > Fields > &lt;Choose correct field> > Take\u00a0<\/em><strong><em>Field Name<\/em><\/strong><em>\u00a0and\u00a0<\/em><strong><em>System Label<\/em><\/strong><em>.<\/em><\/cite><\/blockquote>\n\n\n\n<p>Hope you find this blog post helpful.<\/p>\n\n\n\n<p>Feel free to add comments and queries, that helps us to improve the quality of posts.<\/p>\n\n\n\n<p>You can contact us at&nbsp;<a rel=\"noreferrer noopener\" href=\"mailto:contact@urdhva-tech.com\" target=\"_blank\">info@techcrm.in<\/a><\/p>\n\n\n\n<p>Thank you.<\/p>\n","protected":false},"excerpt":{"rendered":"<p>It will be done by below steps only! Lets do this, STEP 1 : Add a reference to the JavaScript file which will be needed for event binding. Path:\u00a0custom\/modules\/&lt;desired_module>\/metadata\/editviewdefs.php Step 2 : Add the JavaScript file you want to include into the location you referenced above(custom\/modules\/&lt;desired_module>\/js\/editview.js). Step 3 : Write your custom function code in [&hellip;]<\/p>\n","protected":false},"author":2,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[10,9],"tags":[66,22,12,13],"class_list":["post-282","post","type-post","status-publish","format-standard","hentry","category-sugarcrm","category-suitecrm","tag-include","tag-javascript","tag-sugarcrm","tag-suitecrm"],"yoast_head":"<!-- This site is optimized with the Yoast SEO plugin v22.3 - https:\/\/yoast.com\/wordpress\/plugins\/seo\/ -->\n<title>How to call JavaScript function from editviewdefs field of any module in SugarCRM \/ SuiteCRM - TechCRM<\/title>\n<meta name=\"robots\" content=\"index, follow, max-snippet:-1, max-image-preview:large, max-video-preview:-1\" \/>\n<link rel=\"canonical\" href=\"https:\/\/www.techcrm.in\/blogs\/how-to-call-javascript-function-from-editviewdefs-field-of-any-module-in-sugarcrm-suitecrm\/\" \/>\n<meta property=\"og:locale\" content=\"en_US\" \/>\n<meta property=\"og:type\" content=\"article\" \/>\n<meta property=\"og:title\" content=\"How to call JavaScript function from editviewdefs field of any module in SugarCRM \/ SuiteCRM - TechCRM\" \/>\n<meta property=\"og:description\" content=\"It will be done by below steps only! Lets do this, STEP 1 : Add a reference to the JavaScript file which will be needed for event binding. Path:\u00a0custom\/modules\/&lt;desired_module&gt;\/metadata\/editviewdefs.php Step 2 : Add the JavaScript file you want to include into the location you referenced above(custom\/modules\/&lt;desired_module&gt;\/js\/editview.js). Step 3 : Write your custom function code in [&hellip;]\" \/>\n<meta property=\"og:url\" content=\"https:\/\/www.techcrm.in\/blogs\/how-to-call-javascript-function-from-editviewdefs-field-of-any-module-in-sugarcrm-suitecrm\/\" \/>\n<meta property=\"og:site_name\" content=\"TechCRM\" \/>\n<meta property=\"article:published_time\" content=\"2020-05-07T08:00:32+00:00\" \/>\n<meta property=\"article:modified_time\" content=\"2020-09-08T09:21:15+00:00\" \/>\n<meta name=\"author\" content=\"Navin Rakhonde\" \/>\n<meta name=\"twitter:card\" content=\"summary_large_image\" \/>\n<meta name=\"twitter:label1\" content=\"Written by\" \/>\n\t<meta name=\"twitter:data1\" content=\"Navin Rakhonde\" \/>\n\t<meta name=\"twitter:label2\" content=\"Est. reading time\" \/>\n\t<meta name=\"twitter:data2\" content=\"1 minute\" \/>\n<script type=\"application\/ld+json\" class=\"yoast-schema-graph\">{\"@context\":\"https:\/\/schema.org\",\"@graph\":[{\"@type\":\"WebPage\",\"@id\":\"https:\/\/www.techcrm.in\/blogs\/how-to-call-javascript-function-from-editviewdefs-field-of-any-module-in-sugarcrm-suitecrm\/\",\"url\":\"https:\/\/www.techcrm.in\/blogs\/how-to-call-javascript-function-from-editviewdefs-field-of-any-module-in-sugarcrm-suitecrm\/\",\"name\":\"How to call JavaScript function from editviewdefs field of any module in SugarCRM \/ SuiteCRM - TechCRM\",\"isPartOf\":{\"@id\":\"https:\/\/www.techcrm.in\/blogs\/#website\"},\"datePublished\":\"2020-05-07T08:00:32+00:00\",\"dateModified\":\"2020-09-08T09:21:15+00:00\",\"author\":{\"@id\":\"https:\/\/www.techcrm.in\/blogs\/#\/schema\/person\/992dfe427bb53dcdfd72dd80e3ef9dbc\"},\"breadcrumb\":{\"@id\":\"https:\/\/www.techcrm.in\/blogs\/how-to-call-javascript-function-from-editviewdefs-field-of-any-module-in-sugarcrm-suitecrm\/#breadcrumb\"},\"inLanguage\":\"en-US\",\"potentialAction\":[{\"@type\":\"ReadAction\",\"target\":[\"https:\/\/www.techcrm.in\/blogs\/how-to-call-javascript-function-from-editviewdefs-field-of-any-module-in-sugarcrm-suitecrm\/\"]}]},{\"@type\":\"BreadcrumbList\",\"@id\":\"https:\/\/www.techcrm.in\/blogs\/how-to-call-javascript-function-from-editviewdefs-field-of-any-module-in-sugarcrm-suitecrm\/#breadcrumb\",\"itemListElement\":[{\"@type\":\"ListItem\",\"position\":1,\"name\":\"Home\",\"item\":\"https:\/\/www.techcrm.in\/blogs\/\"},{\"@type\":\"ListItem\",\"position\":2,\"name\":\"SugarCRM\",\"item\":\"https:\/\/www.techcrm.in\/blogs\/category\/sugarcrm\/\"},{\"@type\":\"ListItem\",\"position\":3,\"name\":\"How to call JavaScript function from editviewdefs field of any module in SugarCRM \/ SuiteCRM\"}]},{\"@type\":\"WebSite\",\"@id\":\"https:\/\/www.techcrm.in\/blogs\/#website\",\"url\":\"https:\/\/www.techcrm.in\/blogs\/\",\"name\":\"TechCRM\",\"description\":\"Blog\",\"potentialAction\":[{\"@type\":\"SearchAction\",\"target\":{\"@type\":\"EntryPoint\",\"urlTemplate\":\"https:\/\/www.techcrm.in\/blogs\/?s={search_term_string}\"},\"query-input\":\"required name=search_term_string\"}],\"inLanguage\":\"en-US\"},{\"@type\":\"Person\",\"@id\":\"https:\/\/www.techcrm.in\/blogs\/#\/schema\/person\/992dfe427bb53dcdfd72dd80e3ef9dbc\",\"name\":\"Navin Rakhonde\",\"image\":{\"@type\":\"ImageObject\",\"inLanguage\":\"en-US\",\"@id\":\"https:\/\/www.techcrm.in\/blogs\/#\/schema\/person\/image\/\",\"url\":\"https:\/\/secure.gravatar.com\/avatar\/9cc8fd1b948255055b85e5d41dabfc6e704f806d180a1e21cb8fb378e2f5c022?s=96&d=mm&r=g\",\"contentUrl\":\"https:\/\/secure.gravatar.com\/avatar\/9cc8fd1b948255055b85e5d41dabfc6e704f806d180a1e21cb8fb378e2f5c022?s=96&d=mm&r=g\",\"caption\":\"Navin Rakhonde\"},\"sameAs\":[\"https:\/\/www.techcrm.in\/\"],\"url\":\"https:\/\/www.techcrm.in\/blogs\/author\/navin\/\"}]}<\/script>\n<!-- \/ Yoast SEO plugin. -->","yoast_head_json":{"title":"How to call JavaScript function from editviewdefs field of any module in SugarCRM \/ SuiteCRM - TechCRM","robots":{"index":"index","follow":"follow","max-snippet":"max-snippet:-1","max-image-preview":"max-image-preview:large","max-video-preview":"max-video-preview:-1"},"canonical":"https:\/\/www.techcrm.in\/blogs\/how-to-call-javascript-function-from-editviewdefs-field-of-any-module-in-sugarcrm-suitecrm\/","og_locale":"en_US","og_type":"article","og_title":"How to call JavaScript function from editviewdefs field of any module in SugarCRM \/ SuiteCRM - TechCRM","og_description":"It will be done by below steps only! Lets do this, STEP 1 : Add a reference to the JavaScript file which will be needed for event binding. Path:\u00a0custom\/modules\/&lt;desired_module>\/metadata\/editviewdefs.php Step 2 : Add the JavaScript file you want to include into the location you referenced above(custom\/modules\/&lt;desired_module>\/js\/editview.js). Step 3 : Write your custom function code in [&hellip;]","og_url":"https:\/\/www.techcrm.in\/blogs\/how-to-call-javascript-function-from-editviewdefs-field-of-any-module-in-sugarcrm-suitecrm\/","og_site_name":"TechCRM","article_published_time":"2020-05-07T08:00:32+00:00","article_modified_time":"2020-09-08T09:21:15+00:00","author":"Navin Rakhonde","twitter_card":"summary_large_image","twitter_misc":{"Written by":"Navin Rakhonde","Est. reading time":"1 minute"},"schema":{"@context":"https:\/\/schema.org","@graph":[{"@type":"WebPage","@id":"https:\/\/www.techcrm.in\/blogs\/how-to-call-javascript-function-from-editviewdefs-field-of-any-module-in-sugarcrm-suitecrm\/","url":"https:\/\/www.techcrm.in\/blogs\/how-to-call-javascript-function-from-editviewdefs-field-of-any-module-in-sugarcrm-suitecrm\/","name":"How to call JavaScript function from editviewdefs field of any module in SugarCRM \/ SuiteCRM - TechCRM","isPartOf":{"@id":"https:\/\/www.techcrm.in\/blogs\/#website"},"datePublished":"2020-05-07T08:00:32+00:00","dateModified":"2020-09-08T09:21:15+00:00","author":{"@id":"https:\/\/www.techcrm.in\/blogs\/#\/schema\/person\/992dfe427bb53dcdfd72dd80e3ef9dbc"},"breadcrumb":{"@id":"https:\/\/www.techcrm.in\/blogs\/how-to-call-javascript-function-from-editviewdefs-field-of-any-module-in-sugarcrm-suitecrm\/#breadcrumb"},"inLanguage":"en-US","potentialAction":[{"@type":"ReadAction","target":["https:\/\/www.techcrm.in\/blogs\/how-to-call-javascript-function-from-editviewdefs-field-of-any-module-in-sugarcrm-suitecrm\/"]}]},{"@type":"BreadcrumbList","@id":"https:\/\/www.techcrm.in\/blogs\/how-to-call-javascript-function-from-editviewdefs-field-of-any-module-in-sugarcrm-suitecrm\/#breadcrumb","itemListElement":[{"@type":"ListItem","position":1,"name":"Home","item":"https:\/\/www.techcrm.in\/blogs\/"},{"@type":"ListItem","position":2,"name":"SugarCRM","item":"https:\/\/www.techcrm.in\/blogs\/category\/sugarcrm\/"},{"@type":"ListItem","position":3,"name":"How to call JavaScript function from editviewdefs field of any module in SugarCRM \/ SuiteCRM"}]},{"@type":"WebSite","@id":"https:\/\/www.techcrm.in\/blogs\/#website","url":"https:\/\/www.techcrm.in\/blogs\/","name":"TechCRM","description":"Blog","potentialAction":[{"@type":"SearchAction","target":{"@type":"EntryPoint","urlTemplate":"https:\/\/www.techcrm.in\/blogs\/?s={search_term_string}"},"query-input":"required name=search_term_string"}],"inLanguage":"en-US"},{"@type":"Person","@id":"https:\/\/www.techcrm.in\/blogs\/#\/schema\/person\/992dfe427bb53dcdfd72dd80e3ef9dbc","name":"Navin Rakhonde","image":{"@type":"ImageObject","inLanguage":"en-US","@id":"https:\/\/www.techcrm.in\/blogs\/#\/schema\/person\/image\/","url":"https:\/\/secure.gravatar.com\/avatar\/9cc8fd1b948255055b85e5d41dabfc6e704f806d180a1e21cb8fb378e2f5c022?s=96&d=mm&r=g","contentUrl":"https:\/\/secure.gravatar.com\/avatar\/9cc8fd1b948255055b85e5d41dabfc6e704f806d180a1e21cb8fb378e2f5c022?s=96&d=mm&r=g","caption":"Navin Rakhonde"},"sameAs":["https:\/\/www.techcrm.in\/"],"url":"https:\/\/www.techcrm.in\/blogs\/author\/navin\/"}]}},"_links":{"self":[{"href":"https:\/\/www.techcrm.in\/blogs\/wp-json\/wp\/v2\/posts\/282","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/www.techcrm.in\/blogs\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/www.techcrm.in\/blogs\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/www.techcrm.in\/blogs\/wp-json\/wp\/v2\/users\/2"}],"replies":[{"embeddable":true,"href":"https:\/\/www.techcrm.in\/blogs\/wp-json\/wp\/v2\/comments?post=282"}],"version-history":[{"count":1,"href":"https:\/\/www.techcrm.in\/blogs\/wp-json\/wp\/v2\/posts\/282\/revisions"}],"predecessor-version":[{"id":283,"href":"https:\/\/www.techcrm.in\/blogs\/wp-json\/wp\/v2\/posts\/282\/revisions\/283"}],"wp:attachment":[{"href":"https:\/\/www.techcrm.in\/blogs\/wp-json\/wp\/v2\/media?parent=282"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/www.techcrm.in\/blogs\/wp-json\/wp\/v2\/categories?post=282"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/www.techcrm.in\/blogs\/wp-json\/wp\/v2\/tags?post=282"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}