Survey trigger Condition

Nare
Tera Contributor

Hi Everyone,

 

How to implement  service Now survey trigger on Incident table that activates based on either:

  • Every 60 days since the last survey, or

  • After the 5th ticket since the last survey

Can some one help me out the solution.

 

2 REPLIES 2

Katie_Bond
Tera Contributor

We have a survey that appears for every 5 tickets as well!

  1. Ensure the survey is enabled
    • Go to Survey Management > Survey Properties
    • Ensure Surveys are Active and your desired survey is published
  2. Create a Metric or a Custom Table to track survey history*
    *You'll need to store when a user last received a survey and how many incidents they've had since then*
  3. Create a custom table (i.e.: u_user_survey_tracker)
    • Fields: 
      • User (reference to sys_user)
      • Last survey date (date)
      • Incident count since last survey (integer)
  4. Create a business rule on the incident table
    • Run it after the update only if: 
      • The state changes to Closed
      • User is not null
  5. Use GlideSurveyUtils.sendsurvey()
    • This script method lets you trigger a survey programmatically: 
    • GlideSurveyUtils.sendSurvey('<survey_sys_id>', user, current.sys_id);
    • user: sys_user to receive the survey

    • current.sys_id: related record (optional)

  6. Test by impersonating the intended user group, and close 5 incidents as the same user. Confirm the survey only goes out after the 5th or after 60 days

Some nice add-ons after you get it working: 

  • Use Scheduled Jobs to clean up or recheck
  • Add a Last Survey Sent field on the Incident for an audit trail
  • Display survey status on the user's profile or create a report

Nare
Tera Contributor

Hi Katie,

 

Thanks for the solution.

I am following the same point as you mention in the above message.

But, Here i was confused with point 5. where to use GlideSurveyUtils.sendsurvey() method.

I am very bad with coding. Could you please help me with coding?