Versions Compared

Key

  • This line was added.
  • This line was removed.
  • Formatting was changed.

...

It was decided that to implement this feature, a task would be created whenever a respondent requests a follow-up (as offered in the survey). This was accomplished by an "after" business rule on the survey_response table. The condition is supposed to ensure that a task is created only for a matching survey, question, and answer combination:

  • Rule Type: run on server after Insert or Update
  • Condition: current.instance.survey.name.match(/Customer Satisfaction Survey/g) != null && current.question.question_text.match(/follow up/g) != null && current.answer.match(/Yes/g) != null
  • Script:
    Code Block
    //
    // open a task (grab instance name, then get the task survey, then the incident, then the assignment group)
    
    var instance = current.instance.sys_id;
    var survey = new GlideRecord('task_survey');
    survey.addQuery('instance', instance);
    survey.query();
    
    if(survey.next()) {
        newtask = new GlideRecord('task');
        newtask.short_description = 'Customer Satisfaction Survey Follow-Up'
        newtask.parent = survey.task;
        newtask.assigned_to = survey.task.assignment_group.manager;
        newtask.cmdb_ci = survey.task.u_component;
        newtask.description = 'A follow-up has been requested for a resolved incident. Please liaise with the Contact of the Parent task.'
        newtask.insert();
    }