How can I show survey in spmodal window?

Aurelio
Tera Contributor

Hi, I am trying to display the survey in a spmodal as shown in the following image.

Aurelio_0-1689903588320.png

I was investigating and I found that a widget can be displayed in a spModal popup, https://www.youtube.com/watch?v=jtRYa_kUmCI, in the example I found they showed an incident in the popup, but when I do it to display the survey, the survey is not displayed, it is displayed like this.

 

Aurelio_1-1689903671697.png

 

Your help please.

 

This is my code

 

Aurelio_2-1689903753360.png

 

Client Script:

api.controller=function(spModal){
var c = this;

if(c.data.check == true){
spModal.open({
title:"Recordatorio de Encuesta Pendiente 2",
widget:"ibk_take-survey",
widgetInput:{sys_id:'d7e89b6e1bc0391079ab0d47dc4bcb83',table:'asmt_assessment_instance'}
//widget:"widget-form",
//widgetInput:{sys_id:'1515936a1bc0391079ab0d47dc4bcbc1',table:'incident'}
}).then(function(){
alert('Cerrando ventana');
})
}

c.closeModal = function() {
c.modalInstance.close();
}

c.goSurvey = function(){
document.location = "?id=my_surveys";
}

}

 

Server Script:

(function() {
  /* populate the 'data' object */
  /* e.g., data.table = $sp.getValue('table'); */
 
var loggedInUser = gs.getUserID();
data.check = checkForSurvey(loggedInUser);
 
})();
 
function checkForSurvey(user){
 
var gr = new GlideRecord('asmt_assessment_instance');
gr.addQuery("metric_type.active", true);
gr.addQuery("metric_type.publish_state", "published");
gr.addQuery("preview", false);
gr.addQuery('user', user);
gr.addQuery('sys_created_on','>','2021-06-01 23:59:59');
var sub = gr.addQuery('state', 'ready');
sub.addOrCondition('state','wip');
gr.addEncodedQuery('due_date>=javascript:gs.beginningOfToday()');
gr.query();
if(gr.next()){
/* gs.addInfoMessage("Tiene encuestas pendientes"); */
return true;
}else{
/* gs.addInfoMessage("No Tiene encuestas pendientes"); */
return false;
}
}

 

 

 

 

 

1 REPLY 1

RfSnow
Tera Contributor

Hello there, did you found any solution for this?
Best regards