59 views

Description

HR Cases load more slowly when Response Templates are added.

 

 

Steps to Reproduce

  1. On an instance with a large number of HR cases, add a couple of Response Template Snippeta on an HR Case Table with a condition that can meet a large number of HR cases.

  2. Open any HR Case.

    Note that opening the HR case is too slow.

  3. Click on the Response UI action

    Note that the Template Snippet page loads slowly.

 

Workaround

The issue exists in two places:

  • In the NoteTemplateCheck script include, line 23. The code loops through all the cases and creates a delay in loading the page. Use the provided fix code.

    Issue Code:

    var gr = new GlideRecord(currentTable);
    gr.addEncodedQuery(condition);
    gr.query();
    while (gr.next()) {
    if (gr.getValue("sys_id").toString() == sysId) 
    return true; 
    }

    Fix Code:

    var gr = new GlideRecord(currentTable);
    gr.addQuery('sys_id',sysId);
    gr.addEncodedQuery(condition);
    gr.setLimit(1);
    gr.query();
    if (gr.hasNext()) 
    return true;
  • In the UI page message_template, line 31. The code loops through all the cases and creates delay in loading the page. Use the provided fix code.

    Issue code:

    var gr = new GlideRecord(jelly.jvar_table_name);
    gr.addEncodedQuery(condition);
    gr.query();
    while (gr.next()) list.push(gr.getValue("sys_id").toString());

    if (list.indexOf(jelly.jvar_sys_id) != -1)
    categories.push(hrNoteTemp.name.toString());

    Fix code: 

    var gr = new GlideRecord(jelly.jvar_table_name);
    gr.addQuery('sys_id',jelly.jvar_sys_id);
    gr.addEncodedQuery(condition);
    gr.setLimit(1);
    gr.query();
    if (gr.hasNext())
    categories.push(hrNoteTemp.name.toString());

 


Related Problem: PRB1275797

Seen In

Kingston Patch 3a

Intended Fix Version

Kingston Patch 8

Fixed In

London

Safe Harbor Statement

This "Intended Fix Version" information is meant to outline ServiceNow's general product direction and should not be relied upon in making a purchasing decision. The information provided here is for information purposes only and may not be incorporated into any contract. It is not a commitment, promise, or legal obligation to deliver any material, code, or functionality. The development, release, and timing of any features or functionality described for our products remains at ServiceNow's sole discretion.

Associated Community Threads

There is no data to report.

Article Information

Last Updated:2018-07-19 05:56:24
Published:2018-07-19