How to Fetch Choice questions and Additional Comments Response from Survey designer
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
07-19-2023 10:05 PM
@Community Alums @Ankur Bawiskar
Hello Team,
I have Created M2M table between Factor (sn_risk_advanced_factor) and Assessment Metric (asmt_metric) so created table is sn_risk_advanced_m2m_sn_risk_adva_asmt_metric
After that i have created Relationship between sn_risk_advanced_m2m_sn_risk_adva_asmt_metric and Factor table
so I got below view
Now at the end we want to populate the Survey answer(asmt_metric_result) to Risk Assessment Instance Responses (sn_risk_advanced_risk_assessment_instance_response)
At present we have achieved for Normal String Questions for survey but we also want populate the Reference field values and Choice fields question values how can i achieved that script is as below.
BR --> After Update
table - asmt_metric_result
(function executeRule(current, previous /*null when async*/) {
var xyz = new GlideRecord('sn_risk_advanced_m2m_sn_risk_adva_asmt_metric');
xyz.addQuery('u_asmt_metric', current.metric);
xyz.query();
if(xyz.next()){
var abc = questionMapping.u_sn_risk_advanced_factor.sys_id;
var mno = current.instance.trigger_id;
var response = new GlideRecord('sn_risk_advanced_risk_assessment_instance_response');
response.addQuery('assessment_instance_id.sys_id', mno);
response.addQuery("factor.sys_id", abc);
response.query();
if(response.next()){
response.factor_response = current.string_value;
//Reference field and Choice field
response.update();
}
}
})(current, previous);
how can i fetch the choice field values and reference field values from the survey?