Trigger a platform feedback survey for all active users in the sys_user table

mshahvej
Giga Contributor

Hi Team,

I am working on a requirement to create and trigger a survey on a monthly schedule for all active users in the sys_user table.

So far, I have:

  • Created a survey under All > Surveys > View Survey > New

mshahvej_0-1782196291697.png

Created one metric category

mshahvej_1-1782196344578.png

mshahvej_2-1782196413940.png

Added a test question under that category:

mshahvej_3-1782196452548.png

Published the survey
Configured a scheduled job trigger to run on a recurring basis

However, the survey is still not being triggered.

Can anyone please confirm whether I am missing some step or what needs to be corrected here.

1 REPLY 1

Tanushree Maiti
Tera Patron

Hi @mshahvej 

 

  1. Right-click the form header and select Copy sys_id (or double-click the information bar to get it). Note this down.

 

  1. Configure your schedule job:

Navigate to System Definition > Scheduled Jobs.

Click New and select Automatically run a script of your choosing.

Fill in the following details:

  • Name: Send Monthly sys_user Survey
  • Run: Monthly (or choose a specific date/time)

Paste the following script into the Run this script block, being sure to replace 'YOUR_SURVEY_SYS_ID_HERE' with the Sys ID you copied in Step 1:

 

var surveyId = 'YOUR_SURVEY_SYS_ID_HERE'; // Replace with your Survey Sys ID

var grUser = new GlideRecord('sys_user');

grUser.addActiveQuery();

grUser.query();

 

while (grUser.next()) {

   var assessment = new SNC.AssessmentCreation().createAssessments(surveyId, '', grUser.sys_id);

}

 

Refer:

https://www.servicenow.com/community/developer-forum/survey-on-the-sys-user-table/td-p/3179848

https://www.servicenow.com/community/developer-forum/set-survey-to-trigger-every-quarter/td-p/343131...

https://www.youtube.com/watch?v=7hjysB0Wvd4

Please Accept the solution if it assisted you with your question & Mark this response as Helpful.
Regards
Tanushree Maiti
ServiceNow Technical Architect
LinkedIn: https://www.linkedin.com/in/tanushreemaiti
In this video we will see , how can we trigger Surveys or Assessments. ------------------------------------------------------------------------------------------------ 00:00 - Introduction 00:33 - Create a Trigger 03:41 - Test the Survey ...