Error while access Survey in Service Portal

Dhushanth1
Giga Contributor

We are getting the below error when trying to access survey in Service Portal. Can anyone help me on this.

 

find_real_file.png

1 ACCEPTED SOLUTION

hello  @Dhushanth check this function in the script include which is getting called in server script of widget

find_real_file.png

If you open that assessment utils script include again you can see they are returning the glide record object

find_real_file.png

according to that code is it returning assessment instance glide record object for the logged in user 

so check if there are any records for the logged in user  in assessment instance table satisfying the query in the above function.

If not create one and check 

PLEASE MARK MY ANSWER CORRECT IF IT HELPS YOU

View solution in original post

7 REPLIES 7

Mohith Devatte
Tera Sage
Tera Sage

Hello @Dhushanth ,

can you post the server script here please ?

seems like there is a issue in server script 

have you customised any thing?

Hi @Mohith Devatte Thanks for your response. No we didn't change anything regarding this widget. 

 

Server Script:

 

(function() {
  // populate the 'data' object
  // e.g., data.table = $sp.getValue('table');
    data.maxRecords = options.maxRecords || 5;
    var sp = new SPSurveyAPI();
    options.showAll = $sp.getParameter('id') == 'my_surveys';
    if($sp.getParameter('id') != 'my_surveys'){
        if(options.widgetTitle && options.widgetTitle.length>0){
            data.widgetTitle = options.widgetTitle;
        }else{
            data.widgetTitle = gs.getMessage("My Assessments and Surveys");
        }
        data.encodedWidgetTitle = encodeURIComponent(data.widgetTitle);
    } else{
        data.widgetTitle = $sp.getParameter('title') || gs.getMessage("My Assessments and Surveys");
    }
    
    sp.getSurveys(data.maxRecords, options.showAll, data, true);
    data.instances.forEach(function(instance) {
        if (!!instance.description)
            instance.description = $sp.stripHTML(instance.description);
            var percentAnswered = parseInt(instance.percent_answered).toFixed(0) + '%';
          instance.progress_text = gs.getMessage("{0} complete", percentAnswered);
    });

})();

hello  @Dhushanth check this function in the script include which is getting called in server script of widget

find_real_file.png

If you open that assessment utils script include again you can see they are returning the glide record object

find_real_file.png

according to that code is it returning assessment instance glide record object for the logged in user 

so check if there are any records for the logged in user  in assessment instance table satisfying the query in the above function.

If not create one and check 

PLEASE MARK MY ANSWER CORRECT IF IT HELPS YOU

Thank you so much @Mohith Devatte getMySurveys function was missing in Assessmentutils SI. Now I have added it and its working fine now.