AnsweredAssumed Answered

Run Duplicate check on keyup event of backbone

Question asked by Atif Hussain on Aug 19, 2016
Latest reply on Aug 19, 2016 by Atif Hussain

Hi All,

I am using a SugarCRM 7.7.0.0. 

I want to run the default duplicate check functionality of SugarCRM on keyup event of the backbone controller. 

 

So far, I have written the following code to extend the default controller of the record view, and I am unable to find what to do next (how to run the duplication check). 

 

following file is located at: 

custom/modules/Contacts/clients/base/views/record/record.js

({
extendsFrom:'RecordView',

initialize: function(options){
this._super('initialize', [options]);

//Add event that listens for keup event on last_name field
this.events['keyup input[name=last_name]'] = 'checkDuplicates';
},

checkDuplicates: function(){
//Get current value of last_name
var sLast = this.model.get('last_name');

//Check for duplicate vlues if not empty
if (!_.isEmpty(sLast))
{
// run the default duplicate check for the contacts module here.
}
},
})

Any help will be appreciated. 

Outcomes