I want to change all cancelled survey to Ready to take state from backend please

keval3
Tera Contributor

Hi All,

 

My Exit survey has been automatically cancelled because Assessment duration is 14days now I will increases this from 14 to 90 days. but I want to change all cancelled survey to Ready to take state. from backend please let me know how to do it.

 

Thanks & Regards

KP

 

1 REPLY 1

Hemanth M1
Giga Sage
Giga Sage

Hi @keval3 

 

Follow below steps

1)go to Assessment instance table, get all the canclled Assessment number as a query.

2)Execute below script in the background script, line "survey.setWorkflow(false);" opttional - if you want to trigger survey notification if can comment this line and verify Survey trigger notification condition.

 

var qur ="query copied from assessment instance table"; //ex "metric_type.evaluation_method=survey^state=canceled"
var survey = new GlideRecord("asmt_assessment_instance");
survey.addEncodedQuery(qur);
survey.query();
while(survey.next()){
survey.state="ready" //back to ready state
survey.setWorkflow(false)
survey.update();
}

 

 

Hope this helps.

 

 

Accept and hit Helpful if it helps.

Thank you,
Hemanth
Certified Technical Architect (CTA), ServiceNow MVP 2024, 2025