We're reclaiming inactive PDIs to keep them available for active builders. Learn what's changing, who's affected, and how to protect your work. Read More

april_mcgehee
ServiceNow Employee

Seeing double? Double mobile icons that is. Users on a Eureka or Fuji release may be experiencing duplicate icons in their ServiceNow instances on mobile. Icons such as Help, Service Catalog, My Incidents, Contacts, Follow-up, and High Priority, may appear more than once when you are in the mobile UI. The issue is caused by the unintentional creation of duplicate records on the following tables:

  • sys_ui_home_favorite table
  • sys_ui_home_section table
  • label records

Duplicate icons.jpg

When users are removed the records are not getting cleaned up so duplicates are generated in the system.

You may experience upwards of 1,000 duplicate icons if things get messy. Now, that is a sight for sore eyes. Well I've got two troubleshooting paths that will help you remove the home favorite records, home section records, and label records.

To revert your icons to their unique buttons:

Delete the sys_ui_home_favorite records:

  1. Navigate to System Mobile UI > Home Page Favorites.
  2. Filter the list for records where the User field matches the affected user. The filtered list shows the user's favorites. There may be multiple copies of each favorite.
  3. Delete the extra records.

Delete the sys_ui_home_section records:

  1. Navigate to System Mobile UI > Home Page Sections.
  2. Filter the list for records where the User field matches the affected user. The filtered list shows the user's sections. There may be multiple copies of each section.
  3. Delete the extra records.

Delete the label records:

  1. Navigate to System Definition > Tags. (Tags were originally called labels. While the terminology has changed, these records are still stored on the "label" table).
  2. Filter the list for records where the Owner field matches the affected user. The filtered list shows the user's tags. There may be multiple copies of each tag.
  3. Delete the extra records.

This step can also be done by simply running a script in the Scripts- Background.

(function() {

deleteDuplicates('sys_ui_home_section', ['user', 'table', 'label']);
deleteDuplicates('sys_ui_home_favorite', ['user', 'table', 'label', 'icon']);
deleteDuplicates('label', ['owner', 'name', 'short_description', 'background_color', 'color', 'icon']);

// table :: string, fields :: [string]
function deleteDuplicates(table, fields) {
var current = new GlideRecord(table),
prior = new GlideRecord(table);

// ordering will not work on records created by snc hop access due to missing sys_user records
current.addQuery('sys_created_by', 'DOES NOT CONTAIN', '@snc');
prior.addQuery('sys_created_by', 'DOES NOT CONTAIN', '@snc');

// ditch if there are no fields
if(fields.length < 1) {
gs.log('deleteDuplicates requires at least one field');
return false;
}

// order by array of fields passed in
for(i = 0; i < fields.length; i++) {
current.orderBy(fields[i]);
prior.orderBy(fields[i]);
}

  1. current.query();
    prior.query();

// bail if the query returns nothing
if(!current.hasNext()) {
gs.log('no records returned');
return true;
}

// current will always be one ahead of prior
current._next();

// loop through...
var dups = 0;
while(current._next() && prior._next()) {
var i;
// ...and compare adjacent records
for(i = 0; i < fields.length; i++) {
if( current.getValue(fields[i]) != prior.getValue(fields[i]) ) break;
}
if(i == fields.length) {
//gs.log('duplicate detected: current[' + current.sys_id + '] prior[' + prior.sys_id + ']');
//gs.log('deleting [' + prior.sys_id + ']');
prior.deleteRecord();
dups++;
}
}

  1. gs.log("Removed " + dups + " duplicates from " + table);

return true;
}


})();

This business rule can also be loaded into the affected instance as an XML file to prevent a re-occurrence of the issue until a fix is released. You can download the file from here.

To Import records as XML data:

  1. Sign in as an admin to the instance that should receive the data.
  2. Navigate to any list in the system.
    Any list can be used because the XML file contains the destination table name for the records.
  3. Right-click the list header and select Import XML.
  4. In the import screen, click Choose File and select the previously exported XML file.

    Import.png

  5. Click Upload.

Now that you've fixed your duplicate icons you can cancel that eye appointment use the mobile app with ease!

4 Comments
jamesmcwhinney
Giga Guru

I keep deleting these records but they keep coming back right away.


I have not deleted any users.


Do you know else might be causing this?


april_mcgehee
ServiceNow Employee

Hi James,



We don't have any other known errors with this description.



johna have you seen anything else related to this?


John Armstrong
ServiceNow Employee

In addition to removing the elements, there's a set of business rules that can be used to prevent the issue from re-occurring.   The wiki article linked below has an   XML file containing these business rules.


KB0546754



Instructions on how to import the XML file into an instance can be found in the wiki here.


jamesmcwhinney
Giga Guru

Thanks, sorry I forgot I had left this comment earlier.


We used the provided business rules to eliminate the issue.


Thanks,


- James