AnsweredAssumed Answered

How can we add Custom button in Sugar CRM 7.7 ?

Question asked by Parag Mittal on Sep 8, 2016
Latest reply on Sep 8, 2016 by Parag Mittal

Hi Team,

 

How to add Custom button in Sugar CRM 7.7 in Custom/Account Modules.

 

Following is the link which i followed:

 

http://support.sugarcrm.com/Documentation/Sugar_Developer/Sugar_Developer_Guide_7.5/UI_Model/Views/Examples/Adding_Buttons_to_the_Record_View/

 

Following is the working code:

 

record.php 

array (
'type' => 'rowaction',
'event' => 'button:delete_button:click',
'name' => 'delete_button',
'label' => 'LBL_DELETE_BUTTON_LABEL',
'acl_action' => 'delete',
),

 

record.js 

({

extendsFrom: 'RecordView',

initialize: function (options) {
app.view.invokeParent(this, {type: 'view', name: 'record', method: 'initialize', args:[options]});

//add listener for custom button
//this.model.on('button:test_connection_button:click', this.test_connection_button, this);
this.context.on('button:test_connection_button:click', this.test_connection_button, this);
alert("I Am initialize");
},

test_connection_button: function(){
// Write your code here
alert("Friend am triggered.. ");
},


})

 

In the above code i am getting both alert and it is working fine. In the above approach i have added custom button/action  in action row which i do not want.

 

I have two problems which i am trying to solve:

 

1- I want to add custom button which should be visible while user create record and edit record. with the help of the changes which you shared, i have added the button and    that button is only visible in  EDIT record. it is not visible with create record.

 

2- During the loading of edit record i got one alert which came from initialize function. which means initialize function is getting called. but while click on custom button did not get any alert.

 

So could you please suggest me how can i solve both problem.    

Thanks in advance. 

 

Regards,

Deepak

Outcomes