New Survey Management Send After Every Incident

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎01-23-2015 03:57 PM
I'm running into all sorts of unexpected behavior with the new Survey Management in Eureka. I have a requirement to send a survey after every Incident and to have that Incident tied to the survey. I set it up to have the Incident trigger the survey when it's set to Resolved and I have tried various values for Repeat Interval, including 0 and 1 minute. It would appear that if one Survey has already been created for Incident for a user, then they won't get any more Surveys until they complete the first one. Is there a way around this?
Also, I'm having difficulty with Survey Notifications. I need to create two surveys: one for Incident and one for Service Request. I need them to have different verbiage on the emails. There are more advanced conditions we would also like, but this is the first part I'm having trouble with. I tried adding a condition: "Trigger table is incident" but then the notification never gets sent. I verified the value, so I don't know why it wouldn't work.
Any help would be greatly appreciated.
- Labels:
-
Analytics and Reports

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎06-15-2015 12:56 PM
Our workaround was to use the legacy survey application, which handles surveys much differently. I never found a way to use the new survey application with out use case. I wish I had better news for you. Sorry.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎07-31-2015 09:13 AM
Shawn,
I also found this to be a serious flaw in the OOB Surveys that use the Assessment application. But I got around it. It's a bit of work but has been working nicely since implementing.
Two main parts:
1) Replacing (or modify,your choice) the "Trigger Condition" OOB Business Rule "Generate assessment trigger condition". This business rule creates and configures an "Incident Business Rule"
which will create the actual assessment (Survey) when triggered, and it also associates the newly created business rule to the Trigger Condition.
The most important change in this BR will be pointing it to your custom script include, in my case "CustomAssessmentCreation".
this line--> gr.script = "(new SNC.AssessmentCreation()).conditionTrigger(current, '" + current.sys_id + "');";
mine looks like this-->gr.script = "new CustomAssessmentCreation().addAssessment('" + current.sys_id + "');";
I ended up doing a lot of modifications to this BR script because I felt it was pretty rough so I created a new BR and disabled old one, but it creates an "Incident Business Rule" with a script that conatins only this:
new CustomAssessmentCreation().addAssessment('347b54d51d980ac0c2be1df943348fc6');
2) The complex part (and most important) is building a script include replacement for "SNC.AssessmentCreation()", in my case "CustomAssessmentCreation"
Main functions for building a Survey:
addAssessment: proceed with creating assessment record? (e.g.Incident already has one, probability says no, etc.)
_getTriggerRecord: Retrieves the 'Survey Management Trigger Conditions' record (sys_id passed into addAssessment) which contains vital details for building assessment Instances
_createAssessmentGroup: Creates an assessment group to associate assessment Instance too
_createAssessmentInstance: Create assessment
_createAssessmentInstanceQuestion: Find all questions related to a specific assessment category and associate them to a assessment instance.
_RecordHasSurvey: determine if incident already has assessment instance associated to it
The out come of this is a user may never complete a survey (e.g. all surveys remain in "Ready To Take" state) but new ones will still be created for that user.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎09-09-2015 05:27 AM
Chris - can you explain in greater detail your custom script include 'CustomAssessmentCreation()'?
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎12-02-2015 04:02 AM
Hi Christopher,
Did you ever managed to get what Chris is saying above to work? If so can you please share everything that you had to create/modify to make it work?
Thank you,
Bogdan.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎12-08-2015 12:23 AM
For everyone interested also check KB0551395.
The below is a BR on the Incident table with the condition to run when Incident State Changes to Resolved and with the order number lower than the "Auto assessment business rule" of the Trigger condition.
function onAfter(current, previous) {
//This function will be automatically called when this rule is processed.
autoCloseSurveys();
function autoCloseSurveys() {
var pn = 0;
if (pn == 0) {
var gr = new GlideRecord('asmt_assessment_instance');
gr.addQuery('metric_type', '277b148b4f5106007825b3318110c796'); // 277b148b4f5106007825b3318110c796 is the sys_id of the Survey name
gr.addQuery('state', 'ready');
gr.addQuery('user', current.caller_id);
gr.query();
while(gr.next()) {
gr.state = 'canceled';
gr.comments = 'Incident Survey automatically canceled as another incident was Resolved';
gr.update();
}
}
}
}