AnsweredAssumed Answered

How to get primary record in merge-duplicates view using JS Groupings?

Question asked by Artem Mytashop on Feb 11, 2016
Latest reply on Feb 22, 2016 by Artem Mytashop

The goal is: extend "merge-duplicates" function on Contact and Lead with a custom logic and keep any existing custom code that potentially may be present there.

In other words we do not want to overwrite an existing merge-duplicates customization.

 

Previously we have customized (extended) BackboneJS controller, but for now we have to avoid this approach because of a reason described above.

So we are using JS groupings to handle events, but from the code we cannot find the primary record. context.primary always returns a NULL value.

Also looking in app.controller has no effects.

 

Here is the example:

 

(function(app) {

   

    app.events.on('app:view:change', function(view, context) {

        if (view === 'merge-duplicates') {

      context.selectedDuplicates;  // <- Collection of selected records

      context.primary // <- always NULL

    });

 

})(SUGAR.App);

 

Did anyone try to use JS Groupings to extend "merge-duplicates" and get primary record ID ?

 

Thank you.

Outcomes