Updating values in a table using GlideAjax

Pooran
Kilo Contributor

I'm new to SNow and trying to update fields ('address1' in this example) in a table ('table1') using GlideAjax upon submission of a Record Producer. Below are my client & server scripts. I'm not sure what I'm doing wrong but when I submit the RP, the table is not updated at all.

-------------------------------------------------------------

Client Script:

function onSubmit() {

   //Create a new sys_user record and populate the fields with the values below

   var ga= new GlideAjax('queData');

   ga.addParam('sysparm_name', 'insertQData');

   ga.addParam('sysparm_address1', g_form.getValue('address1'));

}

-------------------------------------------------------------

Server Script:

var queData = Class.create();

queData.prototype = Object.extendsObject(AbstractAjaxProcessor, {

    insertQData: function () {

        var address1= this.getParameter('sysparm_address1');

        var gr = new GlideRecord('table1');

        gr.initialize();

        gr.address1= address1;

        gr.insert();

    }
});

-------------------------------------------------------------

1 ACCEPTED SOLUTION

Prateek kumar
Mega Sage

You can make use of record producer script to achieve this.

 
var gr = new GlideRecord('table1');
gr.initialize();
gr.address1= producer.address1;
gr.insert();​

Please mark my response as correct and helpful if it helped solved your question.
-Thanks

View solution in original post

1 REPLY 1

Prateek kumar
Mega Sage

You can make use of record producer script to achieve this.

 
var gr = new GlideRecord('table1');
gr.initialize();
gr.address1= producer.address1;
gr.insert();​

Please mark my response as correct and helpful if it helped solved your question.
-Thanks