How to calculate average Survey score and populate on the RITM or Catalog Task
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎04-07-2025 09:45 PM
Hello everyone,
I have a requirement where I need to send a survey notification to the requester once an RITM is completed. Based on the requester's responses, I need to calculate the average score of the survey and populate it in a custom field (csat_score) in the RITM.
Here are the steps I've taken so far:
- Created a custom field (csat_score) in the RITM and the field will not be visible on the portal side.
- Designed the survey using the Survey Designer.
- Attempted to use Business Rules to calculate and populate the average score, but the score is not being calculated and updated in the RITM.
- Tried to trigger notification using survey trigger condition but notification is not triggering.
I tried with this below Business Rule but score is not calculating also nothing is displayed in RITM field.
(function executeRule(current, previous /*null when async*/) {
if (current.state == 'Closed Complete') {
var surveyResponses = new GlideRecord('asmt_assessment_instance');
surveyResponses.addQuery('source_table', 'sc_req_item');
surveyResponses.addQuery('source_id', current.sys_id);
surveyResponses.query();
var totalScore = 0;
var responseCount = 0;
while (surveyResponses.next()) {
var responseScore = parseInt(surveyResponses.csat_score);
if (!isNaN(responseScore)) {
totalScore += responseScore;
responseCount++;
}
}
if (responseCount > 0) {
var averageScore = totalScore / responseCount;
current.csat_score = averageScore;
current.update();
}
}
})(current, previous);
Please refer the below attachment for my survey questions.
Could anyone guide me on how to achieve this? Any insights or examples would be greatly appreciated!
Thank you in advance for your help!

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎04-08-2025 08:22 AM
What is your business rule running? It looks like you are running it on the RITM table but it should be run against the the asmt_assessment_instance table when state is complete. Then you can use the task field on the asmt_assessment_instance to lookup the RITM and update it.