How to add a pop up in Esc portal for end user to fill the survey for last closed incident

User712413
Tera Contributor

How to add a pop up in Esc portal for end user to fill the survey for last closed incident.

3 REPLIES 3

PrashantLearnIT
Giga Sage

HI @User712413 

 

To add a pop-up in the ESC (Employee Service Center) Portal to prompt end users to fill out a survey for their last closed incident, you can follow these steps:

1. Create a Survey:

  • Create or identify the survey you want to display for closed incidents.
  • Navigate to Survey > Create New Survey or use an existing one.
  • Ensure that the survey is configured to be triggered for incidents, and that it has the necessary questions.

2. Create a Widget for the Pop-Up:

  • You’ll need to create a custom Service Portal Widget that can trigger the pop-up for the survey.
  • Navigate to Service Portal > Widgets and create a new widget.
  • In the widget, use the AngularJS modal functionality (or newer modal features depending on your ServiceNow version) to create a pop-up.

Example of a simple pop-up modal code:

<button class="btn btn-primary" ng-click="openModal()">Take Survey</button>

<script>
function openModal() {
$uibModal.open({
template: `<div class="modal-header">
<h3 class="modal-title">Survey</h3>
</div>
<div class="modal-body">
<p>Please fill out the survey for your last closed incident.</p>
<a href="/sp?id=survey&table=incident&sys_id={{incidentSysId}}" class="btn btn-primary">Go to Survey</a>
</div>
<div class="modal-footer">
<button class="btn btn-default" ng-click="$dismiss()">Close</button>
</div>`,
controller: function($scope, $uibModalInstance) {
$scope.incidentSysId = "<sys_id_of_the_closed_incident>";
}
});
}
</script>

 

  • Replace the incidentSysId with the actual sys_id of the last closed incident, which can be dynamically fetched.

3. Fetch the Last Closed Incident:

  • Use a script include or a client script to fetch the user's last closed incident and pass it to the widget.
  • You can create a server-side script to fetch the last closed incident:

var lastClosedIncident = new GlideRecord('incident');
lastClosedIncident.addQuery('active', false);
lastClosedIncident.addQuery('caller_id', gs.getUserID());
lastClosedIncident.orderByDesc('closed_at');
lastClosedIncident.setLimit(1);
lastClosedIncident.query();
if (lastClosedIncident.next()) {
return lastClosedIncident.sys_id;
}

 

  • Pass the sys_id to the widget for the survey link.

4. Display the Pop-Up Conditionally:

  • You can control when the pop-up shows up using client scripts or UI policies based on the user’s interaction. For example, show the pop-up after a certain action (e.g., when the user visits the homepage of the ESC portal after an incident closure).

5. Embed Widget in the Portal Page:

  • Once the widget is ready, embed it in the ESC Portal by adding it to the relevant portal page.
  • Navigate to Service Portal > Pages, select the page where you want the pop-up to appear (e.g., the homepage or an incident overview page).
  • Drag and drop the widget into the page.

6. Test the Functionality:

  • Thoroughly test the pop-up to ensure it correctly displays for users with closed incidents and links them to the survey.

This will ensure that end users are prompted to fill out a survey for their most recent closed incident when they visit the ESC portal.

 

 

********************************************************************************************************
Please appreciate the efforts of community contributors by marking the appropriate response as the correct answer and helpful. This may help other community users to follow the correct solution in the future.

********************************************************************************************************
Cheers,
Prashant Kumar
ServiceNow Technical Architect


Community Profile LinkedIn YouTube Medium TopMate
********************************************************************************************************

User712413
Tera Contributor

When end use click on Take the survey link it should directly redirect to below page (2nd screen shot) instead of (1st screen shot page). how we remove the 1st page?

User712413_0-1728475772537.png

 

User712413_1-1728476257691.png

 

Hi, 

Im not sure if you had figured this out, but to remove the "get started" page you can follow these steps:

1. View Survey > Open your "Short Customer Satisfaction Survey using Smiley Face" survey.

2. Scroll down to Other Options tab > untick the "Do not show survey introduction notes".

 

GerardAlleB_0-1745552616517.png

 

This will once survey card is clicked via Surveys in portal/redirection this will now show the real survey.

 

---------------------------------------------------
Mark my reply as helpful if this fixes your issue.

Thank you!