Surveys on Demand

terrieb
Tera Guru

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

3 REPLIES 3

Nootan Bhat
Kilo Sage

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

I created the UI button, and added the script above, making the changes indicated, however, when I click on the button, nothing happens.

 

Attaching the UI action for review

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