How to update the records in ATF

Khalid9030
Tera Contributor

Hi Team,

 

In ATF test step from the "Record Query" I can see the 12 records and I want to update the 12 records for that I have taken the Record update.it is updating the only one record instead of the 12 records. How we can update all records from the query.

 

 

2 ACCEPTED SOLUTIONS

Dr Atul G- LNG
Tera Patron
Tera Patron

Hi @Khalid9030 

 

You cant update , bulk records in one go. 

https://www.servicenow.com/community/developer-forum/how-to-set-field-values-of-multiple-records-at-...

 

You may need to write Server side script. 

*************************************************************************************************************
If my response proves useful, please indicate its helpfulness by selecting " Accept as Solution" and " Helpful." This action benefits both the community and me.

Regards
Dr. Atul G. - Learn N Grow Together
ServiceNow Techno - Functional Trainer
LinkedIn: https://www.linkedin.com/in/dratulgrover
YouTube: https://www.youtube.com/@LearnNGrowTogetherwithAtulG
Topmate: https://topmate.io/atul_grover_lng [ Connect for 1-1 Session]

****************************************************************************************************************

View solution in original post

Shaqeel
Mega Sage

Hi @Khalid9030 

 

Assalamalaikum!.

 

Brother, Record Update only update the first record of the output of Record Query.

You need to run Record Update 11 more time (depending on the count of records in Record query).

 

the other way is, you can use Run Server Side script 

Here is the sample:

javascript

var gr = new GlideRecord('incident');

gr.addQuery('assignment_group.name', 'Service Desk');

gr.query();

while(gr.next()) {

gr.assignment_group = 'new_assignment_group_sys_id'; // replace with the sys_id of the new assignment group gr.update(); }

 

Kindly mark helpful/Solution 🙂

 

Regards

Shaqeel


***********************************************************************************************************************
If my response proves useful, please indicate its helpfulness by selecting "Accept as Solution" and " Helpful." This action benefits both the community and me.

***********************************************************************************************************************





Regards

Shaqeel

View solution in original post

2 REPLIES 2

Dr Atul G- LNG
Tera Patron
Tera Patron

Hi @Khalid9030 

 

You cant update , bulk records in one go. 

https://www.servicenow.com/community/developer-forum/how-to-set-field-values-of-multiple-records-at-...

 

You may need to write Server side script. 

*************************************************************************************************************
If my response proves useful, please indicate its helpfulness by selecting " Accept as Solution" and " Helpful." This action benefits both the community and me.

Regards
Dr. Atul G. - Learn N Grow Together
ServiceNow Techno - Functional Trainer
LinkedIn: https://www.linkedin.com/in/dratulgrover
YouTube: https://www.youtube.com/@LearnNGrowTogetherwithAtulG
Topmate: https://topmate.io/atul_grover_lng [ Connect for 1-1 Session]

****************************************************************************************************************

Shaqeel
Mega Sage

Hi @Khalid9030 

 

Assalamalaikum!.

 

Brother, Record Update only update the first record of the output of Record Query.

You need to run Record Update 11 more time (depending on the count of records in Record query).

 

the other way is, you can use Run Server Side script 

Here is the sample:

javascript

var gr = new GlideRecord('incident');

gr.addQuery('assignment_group.name', 'Service Desk');

gr.query();

while(gr.next()) {

gr.assignment_group = 'new_assignment_group_sys_id'; // replace with the sys_id of the new assignment group gr.update(); }

 

Kindly mark helpful/Solution 🙂

 

Regards

Shaqeel


***********************************************************************************************************************
If my response proves useful, please indicate its helpfulness by selecting "Accept as Solution" and " Helpful." This action benefits both the community and me.

***********************************************************************************************************************





Regards

Shaqeel