18 Replies · Latest reply on May 23, 2017 6:41 PM by ravali yadavalli

    New records inserted whenever updated

      Hi all,

       

      I have a requirement where i need to populate 'Work Notes' on 'Change Request' form Affected CI's table. I am able to achieve this but i have a

      problem i.e whenever i am trying to change 'State' field or do any changes on the form and save each time its creating the same set of Affected

      CI's in the work notes.

       

      Please see the below screen shot.

       

       

      My code looks like below:

       

      Business rule : Executes on 'Before' with 'Insert' and 'Update'

       

      var look2=new GlideRecord('task_ci');

        look2.addQuery('task',current.sys_id);

        look2.query();

       

        while (look2.next())

       

        {

        current.work_notes = look2.ci_item.getDisplayValue();

        //look2.task = current.sys_id;

        look2.update();

        }

       

      Kindly can anyone help me on this that it should not create the same record again and again each time i change something on form and update.

       

      Thanks,

      Neha