Can i update values of the 2 tables (Change_Request and asmt_assessment_instance) in one BG Script?

Gayathree Seeth
Tera Expert

Can i update values of the 2 tables (Change_Request and asmt_assessment_instance) in one BG Script?

 

1. Change request survey stored in the  asmt_assessment_instance table.

2. So i wanted fill the value of the  asmt_assessment_instance table and then close the change task.

3. Is that possible in one go using the Background script. Please Assist.

4 REPLIES 4

Ankur Bawiskar
Tera Patron
Tera Patron

@Gayathree Seeth 

yes if you are able to get relationship between the records for 2 tables

what did you start with and where are you stuck?

If my response helped please mark it correct and close the thread so that it benefits future readers.

Regards,
Ankur
Certified Technical Architect  ||  9x ServiceNow MVP  ||  ServiceNow Community Leader

Just wanted to know what kind of relationship is that. Could you give an example. I am gliding inside table and setting the values to update.

Runjay Patel
Giga Sage

Hi

 

You can follow below steps.

  1. Glide record (gr1) on asmt_assessment_instance table with filter "trigger_table=change_task^state=ready^metric_type=sys_id of your survey".
  2. Run while loop to get all the pending survey which not yet completed.
  3. Now again do glide record (gr2) on asmt_assessment_instance_question table to get the associated question and user filter like "instance=sys_id of assessment (gr1.sys_id)" which you will get from first loop. 
  4. Now in 2nd while loop set the answer for the question and update.
  5. In 1st while loop close the close the change task while updating the state.

 

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

If you found my response helpful, please consider selecting "Accept as Solution" and marking it as "Helpful." This not only supports me but also benefits the community.


Regards
Runjay Patel - ServiceNow Solution Architect
YouTube: https://www.youtube.com/@RunjayP
LinkedIn: https://www.linkedin.com/in/runjay

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

Thanks Runjay,

 

But i am notable to glide two tables and mainly i could not able to do bulk update. (gr.addEncodedQuery("query")