Survey/Assessment Invitation Emails instead of restricting the trigger conditions
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
2 hours ago
When I rolled out a basic Post-Incident Survey in 2016, I was unhappy with the trigger conditions and wanted some customizability in how often someone would receive a notification invitation to take a survey and remind them less often if they've already filled one out recently. I saw there's a value in properties where you can exclude them from surveys if they did one of the same type within X days, but that wasn't enough for me.
What I decided was for an assessment to be created for every non-IT, non-automatic generated INC (through filtering the Trigger Condition) but I simply wouldn't send a notification for every new assessment generated. At the bottom of all INC closed tickets there would be a little link about if they would like to fill out a survey and that would take them to all recent assessments assigned to them, but I needed a business rule that ran whenever assessments were created that would decide whether or not to send an invitation to take the survey.
It's an AFTER INSERT business rule, and condition against only that one [Incident Satisfaction] metric type and not all future assessments that we might want to use.
The logic on that business rule is here:
if (eligNotify()){
gs.eventQueue("survey.invitation",current);
}
function eligNotify(){
var sr = new GlideRecord('asmt_assessment_instance');
sr.addQuery('user',current.user);
sr.addQuery('sys_created_on','>',gs.daysAgo(55)); //won't ask them if they've done a survey in the past 55 days
sr.addQuery('state','complete');
sr.query();
if (sr.getRowCount()==0){
var rng = Math.floor((Math.random() * 100)+1); //random decimal*100+1 rounded down
if (current.user.vip == false){ //non VIPs would only receive it 25% of the time
if (rng%4==0) //25%
return true;
}
else { //want VIPs to receive survey invites more often
if (rng%4==0 || rng%5==0) //40%
return true;
}
return false;
}
}

