Survey without table

Renjisha
Tera Contributor

I have a requirement to trigger surveys for specific users on a quarterly basis. It is not related to any records or table trigger conditions; the survey should simply be sent to specific users quarterly. Is this possible

1 ACCEPTED SOLUTION

Runjay Patel
Giga Sage

Hi @Renjisha ,

 

Yes, you can do this, follow below steps.

  1. Create/design your survey.
  2. Now go to your survey and add user under related list "Survey Users"
  3. RunjayPatel_0-1732515593889.png

     

  4. Create one schedule job and run that quarterly.
  5. RunjayPatel_1-1732515868338.png

     

  6. Script: 

 

var surveyId = '502a2c44d7211100158ba6859e6103a3'; // replace it with your survey sysid
var returnIds = new SNC.AssessmentCreation().createAssessments(surveyId);
	var returnValues = returnIds.split(',');
	if (returnValues.length >= 2)
		users = parseInt(returnValues[1]);
	else
		users = 0;
	if (users > 0)
		gs.log(gs.getMessage('Invited {0} users to take the survey.', users+''));
	else
		gs.log(gs.getMessage('No new invitation sent for the survey'));

		​

 

 

-------------------------------------------------------------------------

If you found my response helpful, please consider selecting "Accept as Solution" and marking it as "Helpful." This not only supports me but also benefits the community.


Regards
Runjay Patel - ServiceNow Solution Architect
YouTube: https://www.youtube.com/@RunjayP
LinkedIn: https://www.linkedin.com/in/runjay

-------------------------------------------------------------------------

 

 

View solution in original post

1 REPLY 1

Runjay Patel
Giga Sage

Hi @Renjisha ,

 

Yes, you can do this, follow below steps.

  1. Create/design your survey.
  2. Now go to your survey and add user under related list "Survey Users"
  3. RunjayPatel_0-1732515593889.png

     

  4. Create one schedule job and run that quarterly.
  5. RunjayPatel_1-1732515868338.png

     

  6. Script: 

 

var surveyId = '502a2c44d7211100158ba6859e6103a3'; // replace it with your survey sysid
var returnIds = new SNC.AssessmentCreation().createAssessments(surveyId);
	var returnValues = returnIds.split(',');
	if (returnValues.length >= 2)
		users = parseInt(returnValues[1]);
	else
		users = 0;
	if (users > 0)
		gs.log(gs.getMessage('Invited {0} users to take the survey.', users+''));
	else
		gs.log(gs.getMessage('No new invitation sent for the survey'));

		​

 

 

-------------------------------------------------------------------------

If you found my response helpful, please consider selecting "Accept as Solution" and marking it as "Helpful." This not only supports me but also benefits the community.


Regards
Runjay Patel - ServiceNow Solution Architect
YouTube: https://www.youtube.com/@RunjayP
LinkedIn: https://www.linkedin.com/in/runjay

-------------------------------------------------------------------------