How can I add custom button next to Save, Cancel on Account module and custom module?

Hi Team,

Can some one suggest us the way to add custom button next to SAVE, CANCEL Any module and custom Module.

Also please suggest how can we write some custom on the click of the button.

Regards,

Deepak

Parents Reply Children
  • Hi Parag Mittal

    Okay, you are using sugar 6.x.

    custom/modules/Accounts/metadata/editviewdefs.php and add this code:

    'templateMeta' => 
        // Add this code
        array (        
           'javascript' => '       
                <script src="./include/javascript/jquery.min.js" type="text/javascript"></script> 
                <script src="./custom/include/javascript/test.js" type="text/javascript"></script> 
           ', 
        ),        
        array (
           'buttons' =>
            array (
              0 => 'SAVE',
              1 => 'CANCEL',
              // Add This code
              2 =>
              array (
                'customCode' => '<input id="MyButton" title="My Button" class="button" type="button" name="MyButton" value="My Button" onclick="myButtonFunt();">',
            ),
        ),

    Now in your custom/include/javascript/test.js file write all your script code to do so:
    $(document).ready(function(){
       function myButtonFunt(){   

            console.log("Hi Friends am Triggered..");

       }
    });
    Once check with this approach and let me know if you found any issues.
    Hope this Helps

    Best Regards

    S Ramana Raju