On-Call Schedule page duplicate Group causing client side JS error when a pinned group that is not set to download in first 20/40 batch is unpinned and loaded second time via scroll.
JS error: 
Error: [ngRepeat:dupes] http://errors.angularjs.org/1.4.8/ngRepeat/dupes?p0=group

Steps to Reproduce

  1. Activate On-Call Scheduling plugin com.snc.on_call_rotation.
  2. Create 60 cmn_rotas and pin a high numbered group, something that needs a couple of scroll loads.
  3. Unpin the group and then scroll to load it


Modify UI Script: sn_on_call_now.app sys_ui_script_81e734b1d7000300532c24837e610361.xml


groupOnCallCtrl.groups = groupOnCallCtrl.groups.concat(groups);

groupOnCallCtrl.groups = _uniqueConcat(groupOnCallCtrl.groups, groups);

And adding the following function to that controller: 

function _uniqueConcat(arr1, arr2) {
        if (!arr1 || arr1.length == 0) {
            if (!arr2 || arr2.length == 0)
                return [];
                return arr2;

        if (!arr2 || arr2.length == 0)
            return arr1;

        var uniqueSet = {};
        var dupArr = arr1.concat(arr2);
        dupArr.forEach(function(elem) {
            if (elem.id)
                uniqueSet[elem.id] = elem;

        if (typeof Object.values === "function")
            return Object.values(uniqueSet);

        var uniqueArr = [];
        Object.keys(uniqueSet).map(function (key) { uniqueArr.push(uniqueSet[key]); });
        return uniqueArr;

Related Problem: PRB1198231

Seen In

There is no data to report.

Fixed In


Associated Community Threads

There is no data to report.

Article Information

Last Updated:2018-02-21 02:51:53