29 views

Description

When trying to load/open the record for a custom interactive filter, a huge memory spike occurs and the application node can potentially run out of memory.

Steps to Reproduce

Go to /sys_ui_hp_publisher.do?sys_id=f17a3712db118f40b43afa5aaf9619de&sysparm_view&sysparm_domain=null&sysparm_domain_scope=null.

Observe the memory spike and see that the transaction keeps running.

Workaround

Disable the business rule GetDynamicaTableValuesForFilter and see that record opens almost instantly after and no memory issues.

This workaround has three parts: Editing a dictionary definition, editing a business rule, and creating a client script.

  1. Navigate to System Definition > Dictionary.

  2. Search on the column name default_reference_field_value., and click the table name to open the dictionary entry.
  3. Replace the content of the Attributes text box with no_sort=true,slushbucket_ref_no_expand=true.

  4. Click Update.

  5. Navigate to System Definition > Business Rules.

  6. Search for the name "GetDynamicaTableValuesForFilter" and click on the name to open the rule's record.

  7. Clear the Active check box and click Update.

  8. Navigate to System Definition > Client Scripts and click New.

  9. Create a new client script with the following values:

    • Name: Reference Table Page Load
    • Table: Interactive Filter [sys_ui_hp_publisher]
    • Type: OnLoad
    • Description: Load slushbucket on page load.
    • Paste the following into the Script editor:
    function onLoad() {
    var type = g_form.getValue("type");
    if(type == "2") {
    var availableDefaultReferenceField = gel("sys_ui_hp_publisher.default_reference_field_value_left");
    var selectedDefaultReferenceField = gel("sys_ui_hp_publisher.default_reference_field_value_right");
       var availableOptions = availableDefaultReferenceField.options;
       var selectedOptions = selectedDefaultReferenceField.options;
       var availableOptionsLength = availableOptions.length;
       availableDefaultReferenceField.options.length = 0;
       selectedDefaultReferenceField.options.length = 0;
       var referenceConditions = gel("sys_ui_hp_publisher.reference_conditions");
       var currentTableSelected = g_form.getValue("reference_table");
       var encodedCondition = g_form.getValue("reference_conditions");
       var selected = document.getElementById("sys_original.sys_ui_hp_publisher.default_reference_field_value").value;
       selected = selected.split(",");
       
       var handleTableSelection = function (response) {
          var answer = response;
          var result = response.responseXML.getElementsByTagName("result");
          var recordsString = result[0].getAttribute("record");
          var records = JSON.parse(recordsString);
          for(var i = 0, j = 0;i<records.length;i++){
             var opt = new Option(records[i].value, records[i].key);
             availableOptions[i]= opt;
             var index = selected.indexOf(records[i].key);
             if(index > -1) {
                var opt2 = new Option(records[i].value, records[i].key);
                selectedOptions[j]= opt2;
                j++;
             }
          };
          
          var ga = new GlideAjax('ReferenceFilterTableSelection');
          ga.addParam("sysparm_name","getRecords");
          ga.addParam('sysparm_reference_table',currentTableSelected);
          ga.addParam('sysparm_reference_conditions',encodedCondition);
          ga.getXML(handleTableSelection);
       }
    }

Related Problem: PRB1192920

Seen In

There is no data to report.

Fixed In

Kingston Patch 5
London

Associated Community Threads

There is no data to report.

Article Information

Last Updated:2018-08-31 11:58:17
Published:2018-08-28