5 Replies · Latest reply on Jan 13, 2018 2:31 AM by ashutoshm1

    Update record not working in discovery sensor

      I am trying to update couple of field values for ip switch from an SNMP sensor. The idea is to compare the existing value and then update if it is different , the control is able to compare and update the field in the code. But when I go to the record in switch table the value is not replaced! If the field value is empty then it is populated correctly. From the log messges there the update from my sensor happens but then gets reset to older values. How do I find a trigger for this ?

       

      I have checked bussiness rules and data policies but none of them are toggling the fields I'm trying to update.

       

      Is there any missing flag for update?

       

       

      (putting this code as javascript is adding as a table and messing up the syntax)

      var ci = new GlideRecord(devci['table']);

      ci.addQuery('sys_id', devci.data.sys_id);

      ci.query();

       

      if(ci.next())

      {

      var oldval = ci.getValue('field_1');

           if(oldval != newval)

           {

                ci.field_1=newval;

                ci.update();

           }

      var oldf2val = ci.getValue('field_2');

           if(oldf2val != newval2)

           { //ci.field_2 = newval2;

           ci.setValue('field_2',newval2);

           ci.update(); }

      } }