Surveys on Demand

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
02-16-2023 05:22 AM
Creating a survey for completed Projects in the PPM module.
I have been tasked with the questions below:
- Can the survey be triggered manually with like a button on the Project form to be sent out randomly instead of when the project goes to Closed state?
- Can the person receiving the survey be selected when it is triggered manually?
Thanks

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
02-20-2023 04:33 AM
Hi @terrieb,
You can create a Survey trigger Condition. Which will be triggered when a field (can create custom field) changes to some value. When survey condition created, business rule will be created automatically.
Also you can use a User referenced field to select the survey user.
Go through: Get started with Survey Management (servicenow.com)
Or else you can create an UI action, which will call a Ui page where you can select the users manually.
And in the Server script you can use the below code:
var response = new AssessmentUtils().createAssessments('metric_sys_id', // Assessment metric type sys_id
'', // Assessable record which is the source of the assessment. Keep it empty
'user_sys_id' //get it from the UI page selection
);
//extra steps if you want to link the assesments to the source record
var surveyId = response.split(',')[0];
var sgr = new GlideRecord('asmt_assessment_instance');
if(sgr.get(surveyId)){
sgr.trigger_id = current.getUniqueValue();
sgr.task_id = current.getUniqueValue();
sgr.trigger_table = 'TABLE_NAME';
sgr.update();
}
Let me know if it helped.
Thanks
Nootan

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
03-23-2023 08:31 AM

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
03-24-2023 04:56 AM
Hi @terrieb,
Please make sure your UI action is a Server side UI action instead of Client side.
Also pass the user sys_id in the line 1.
The script if made for business rule.
if you are using it for UI action, You need to update the script accordingly, ex: adding script inside the function, adding redirection url etc.
Thanks