search cancel

Modifying a dataset doesn’t call an onChange event

book

Article ID: 214327

calendar_today

Updated On:

Products

CA Service Management - Service Desk Manager

Issue/Introduction

If a line / dataset of a table, with a single editable text field, is in edit mode, a ‘Return’ causes the entire dataset been saved, without(!) calling an onChange event for that specific text field.

The issue is visible at the Chrome or Edge debugger:

Uncaught TypeError: ca_fd.js.myFunc is not a function

    at eval (eval at switchFdScope (formdesigner.js?v=-810602581:528), <anonymous>:1395:98)

    at _returnResultSet (formdesigner.js:221)

    at Object.success (formdesigner.js:267)

    at Object.resolveWith (jquery.js:1)

    at w (jquery.js:1)

    at XMLHttpRequest.d (jquery.js:1)

The spotted entries are marked:

Usually the formdesigner.js is initialized (-810602581:). But not at this function. It seems, that this instance/object doesn’t even know that function.!?

Note: The functions, been defined at the fields’ attributes aren’t executed as well.

 

Environment

Release : 17.3

Component : CA SERVICE CATALOG

Resolution

Suggested to make some changes in the script as a sample below and verify the behavior i.e. since this is an issue with the 'switchFdScope' error as per the screenshot

incident_nr : function()

      {

      // Wenn der Wert id_id_nr_altgeraet ermittelt worden ist,

      // dann muss dieser auch für den Gerätetausch bereitgestellt werden

            var cca_temp = ca_fdGetTextFieldValue(ca_fd.formId,'id_incident_nr');

            ca_fd.js.Logging('Funktion "incident_nr" mit der ID '  + cca_temp + ' gefunden.');

      ca_fd.js.Logging(typeof(ca_fd.js.myFunc));

           var scope = ca_fd.fdScope;
  var id = ca_fd.formId;

            ca_reportQuery('ITPAM-SDM-Incident',{'Incident_ID':cca_temp}, function(rows){ ca_fd.switchFdScope(scope,id);ca_fd.js.myFunc(rows)}, null);

},

Additional Information

This is not something created recently and if there are multiple forms, this is how the use ca_fd.reportQuery need to be defined.
Its recommended and all the customers are requested to follow the same approach for best results

Full Sample Script for further Review

Formular-Script:

// -- Wird von checkbox_on() (onLoad-Event) aufgerufen, wenn der Status <=1001 ist und füllte alle Daten zum Incident und Configuration Item in den Request

incident_nr : function()

      {

      // Wenn der Wert id_id_nr_altgeraet ermittelt worden ist,

      // dann muss dieser auch für den Gerätetausch bereitgestellt werden

            var cca_temp = ca_fdGetTextFieldValue(ca_fd.formId,'id_incident_nr');

            ca_fd.js.Logging('Funktion "incident_nr" mit der ID '  + cca_temp + ' gefunden.');

      ca_fd.js.Logging(typeof(ca_fd.js.myFunc));

           

            ca_reportQuery('ITPAM-SDM-Incident',{'Incident_ID':cca_temp}, function(rows){ ca_fd.js.myFunc(rows)}, null);

},

// -- Abfragen ---------------------------------

      myFunc : function(rows)

      {

      // populate form text fields with values from the first row

            if (rows.length > 0)

            {

                  for (field in rows[0])

                  {

if((field == 'alt_wartungsende') || (field == 'neu_wartungsende')
|| (field == 'id_garantiebeginn_neu') || (field == 'id_garantieende_neu')
|| (field == 'neu_installdate') || (field == 'neu_wartungsende_lager'))

                        {

                              ca_fdSetDateFieldValue(ca_fd.formId, field, rows[0][field]);

                        } else if (field == 'id_lieferadresse'){

                              var name = rows[0][field].toString();;

                              var value = rows[0].id_lieferadresse_nr.toString();;

                              ca_fdSelectOption(ca_fd.formId, field, name, value);

                              ca_fd.js.Logging('Feldwert: '+ name +' : '+ value);

                        } else if (field == 'id_geraete_modellvorschlag'){

                              var name = rows[0][field].toString();;

                              var value = rows[0].id.toString();;

                              ca_fdSelectOption(ca_fd.formId, field, name, value);

                              ca_fd.js.Logging('Feldwert: '+ name +' : '+ value);

                        } else {

                              ca_fdSetTextFieldValue(ca_fd.formId, field, rows[0][field]);

                        }

                  ca_fd.js.Logging('Result: '+field+' : '+rows[0][field]);

                  }

            }

      },

...

Formdesigner.js

// add window global functions

      window.ca_reportQuery = function(reportId, variables, _onSuccess, _onFailure, bucketSize, bucketNum) {

        if (typeof (_onSuccess) != "function")

          return;

 

Uncaught TypeError: ca_fd.js.myFunc is not a function

    at eval (eval at switchFdScope (formdesigner.js?v=-810602581:528), <anonymous>:1395:98)

    at _returnResultSet (formdesigner.js:221)

    at Object.success (formdesigner.js:267)

    at Object.resolveWith (jquery.js:1)

    at w (jquery.js:1)

    at XMLHttpRequest.d (jquery.js:1)

This function is called in the form’s onLoad, to set some fields with values from the DB.
It worked fine up to now (17.1.08)

Attachments