How to show Survey as Modal Pop-up in Portal

reddy8055
Tera Contributor

Hi,

We have catalog item link in Service portal so whenever user click the link it should show Survey as Modal Pop-up and where user need to fill the survey. So I have modified the widget client script like below its showing survey widget not actual form to fill in. Please help me on this. Thanks

HTML

<button ng-click="c.openSurveyModal()">Report a Problem</button>

Client script:

var p = 'sysparm_assessable_type';
var q = 'instance_id';
 
c.openSurveyModal = function() {
  if (typeof spModal === 'undefined') {
    return;
  }
  spModal.open({
    title: 'Survey',
    widget: 'surveys',
    buttons: [
      { label: '', hide: true },
      { label: '', hide: true }
    ],
    widgetInput: {
     //sys_id: 'f0a6037c977551101eaade24a253afc7'
//sys_id: 'c35a803bdb907600c894591e5e961980'
//p: 'f0a6037c977551101eaade24a253afc7'
q: 'ff010f5b87443550549484c4dabb3507'
 
///window: "/assessment_take2.do?sysparm_assessable_type=f0a6037c977551101eaade24a253afc7"
    },
//templateUrl: 'survey_modal_template.html', 
    onClose: function(result) {
      
    }
  });
    
};
Thanks,
6 REPLIES 6

Riya Verma
Kilo Sage
Kilo Sage

Hi @reddy8055 ,

 

To enable a Survey Modal Pop-up when users click on the "Report a Problem" link in the Service Portal:

 

HTML Code:

 

<button ng-click="c.openSurveyModal()">Report a Problem</button>

 

 

Client script :

 

c.openSurveyModal = function() {
  if (typeof spModal === 'undefined') {
    return;
  }
  spModal.open({
    title: 'Survey',
    widget: 'surveys',
    buttons: [
      { label: '', hide: true },
      { label: '', hide: true }
    ],
    widgetInput: {
      q: 'ff010f5b87443550549484c4dabb3507'
    },
    onClose: function(result) {
      // Add any necessary actions to be performed after the survey is completed
    }
  });
};

 

 
Please mark the appropriate response as correct answer and helpful, This may help other community users to follow correct solution.
Regards,
Riya Verma

Hi,

I am not seeing the form in the Modal its showing blank.

reddy8055_0-1689970576856.png

Thanks,

Modify the model part , specifying the label:'ABC' and segt hide: false.

For more reference on how to set modal , please refer this tutorial video:
https://www.youtube.com/watch?v=ADmDpbX94Mk

 
Please mark the appropriate response as correct answer and helpful, This may help other community users to follow correct solution.
Regards,
Riya Verma
Hi All, Welcome back. I m very glad to bring this video to you. Today we will be looking at something which really pleased me a lot and I was looking for something like this for a long time. Today we will be looking at how we can Enhance your Catalog Items with Contextual Popups. We all must have

I checked this one, I am able to create a Modal but survey form is not showing up instead it is showing as widget.

Please see below screenshot.

 

reddy8055_0-1689971461587.png

I am not able see this information instead it showing as above. If click on that widget it takes to this form

reddy8055_1-1689971524567.png