How can i bulk update date value in servicenow

IamAmolB
Tera Guru

Hi Experts,

I want to copy some date value from another table in bulk. i want to set a   value for almost 4k records.

tried with,

1. rec.u_test_cancel_date = rec.u_project_id.end_date.getGlideObject();

2. rec.u_test_cancel_date = rec.u_project_id.end_date.getDisplayValue();

3. rec.u_test_cancel_date.setValue(rec.u_project_id.end_date);

but when i run this for bulk update in background script it will run for only one record and update only one record.

Do we have any other way to resolve this as it is not able to update all the records in a single run.

Regards,

Amol Bavaskar.

+91-9405444404

1 ACCEPTED SOLUTION

Hi Julian,



Here is the script :




var rec = new GlideRecord('u_test_plan');


rec.addQuery('u_request_status','canceled');


rec.addQuery('u_test_cancel_date','');


//rec.setLimit(3);


rec.query();



gs.print("row :: "+rec.getRowCount());



while(rec.next()) {


      rec.u_test_cancel_date = rec.u_project_id.end_date;


      gs.print('Project_ID :: '+rec.u_project_id);


      gs.print('End Date     :: '+rec.u_project_id.end_date);


      rec.update();


   


}


View solution in original post

20 REPLIES 20

Amlan,



I have the same question.. could please explain, what changes in the scoped application?