How to trigger Survey through Send Survey Button manually

Chaitanya Redd1
Tera Guru

Hello Team,

I have created "Send Survey" Button on incident Form and written below script and Set BR - "Auto assessment business rule" - False but, it's not working. Can anyone look into below script and help where I have gone wrong.

var gr = new GlideRecord('asmt_assessment_instance');
gr.addEncodedQuery('metric_type=99471f319f0312006371f84bc42e70f1^user='+current.caller_id+'^trigger_id='+current.sys_id); //Here in the metric_type add the sys_id of your Survey from 'asmt_metric_type' table
gr.query();
if(gr.hasNext()){
gs.addErrorMessage("Surevy already sent to user!");
action.setRedirectURL(current);
}
else{
var survey_notification=new GlideRecord('incident');
survey_notification.get(current.sys_id);
survey_notification.u_survey_notification=true;
survey_notification.update();
gs.addInfoMessage(" successfully assigned survey to caller");
action.setRedirectURL(current);
}
 
 
Thanks,
Chaitanya
1 ACCEPTED SOLUTION
1 REPLY 1