New cases are not being created.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎05-11-2022 08:10 AM
We have a requirement to create new cases whenever a customer survey response has a response score between 0-6. For the same It have written the code below. I worked well for a long time but suddenly stopped creating new cases. I tried to debug by adding info messages in various places, turns out the code is not even entering the for loop.
var ResultSurvey = [];
var description = '';
var createCase = false;
var gr = new GlideRecord("asmt_metric_result");
gr.addQuery('instance', current.sys_id);
gr.query();
while (gr.next()) {
description += gr.getDisplayValue('instance_question') + " : " + gr.getDisplayValue('string_value') + "<br/>";
ResultSurvey.push(gr.getDisplayValue('actual_value'));
}
for (var i = 0; i < ResultSurvey.length - 1; i++) {
gs.addInfoMessage("entered");
if (ResultSurvey[i] <= 6) {
createCase = true;
}
}
if (createCase == true) {
var gr1 = new GlideRecord("sn_customerservice_case");
gr1.initialize();
gr1.insert();
}
Does anyone has any inputs on how to troubleshoot this issue will be appreciated.
Thanks.
- Labels:
-
Customer Service Management

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎05-11-2022 10:14 AM
Hello,
It shouldn't just randomly stop working...if it did before.
With that said, you'd want to use troubleshooting/logging to help walk it along, else you're just coding in the dark.
For this line:
for (var i = 0; i < ResultSurvey.length - 1; i++) {
you may want to try changing it to:
for (var i = 0; i < ResultSurvey.length; i++) {
Please mark reply as Helpful/Correct, if applicable. Thanks!
Please consider marking my reply as Helpful and/or Accept Solution, if applicable. Thanks!
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎05-11-2022 12:34 PM
Hi
Did you try to put an InfoMessage as the first statement in your Business Rule?
If you did and there was no InfoMessage then you can below checks:
As you mentioned that it worked previously, so please check if there is any new Business Rule created which is running before your Business Rule.
Remark: Check all Business Rules which are lesser in order or higher in priority with the same order as your Business Rule. Lookout if the script contains setWorkflow(false)
If there are no such Business Rules then look out for associated Service Side scripts (Script Include, Workflow - Run Script) where setWorkflow(false) is written.
Please mark my answer as correct if this solves your issues!
If it helped you in any way then please mark helpful!
Thanks and regards,
Kartik
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎05-11-2022 08:08 PM
Hi
Was your issue solved?
Thanks and regards,
Kartik