Notifications

246 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 Snippets 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 very 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

Fixed In

Kingston Patch 8
London

Associated Community Threads

There is no data to report.

Article Information

Last Updated:2018-11-06 10:38:45
Published:2018-08-31