Pending surveys link pop up when user logs in to service portal

Bhagya
Tera Contributor

Hi All,

 

Below is the requirement where I need some help.

 

When any user logs in to the Service portal, a popup should come up stating that you havepending surveys. Please attempt the surveys before they expire.

 

2 REPLIES 2

chetanb
Tera Guru

Hello @Bhagya 

 

This could be possible in various ways like clinet script,ui script.

With the below onload uiscript you can try to implement first in your dev or anyother lower env.


var currentUser = gs.getUser();

var grSurveys = new GlideRecord('sn_survey_definition');
grSurveys.addQuery('active', true);
grSurveys.addQuery('state', 'open');
grSurveys.addQuery('assigned_to', currentUser);
grSurveys.query();

if (grSurveys.next()) {
// popup message
var message = "You have pending surveys! Please attempt them before they expire: <br>";

while (grSurveys.next())
{
message += "<a href='" + grSurveys.getDisplayURL() + "'>" + grSurveys.getValue('name') + "</a><br>";
}

// Show the popup using GlideDialog
GlideDialog.show("Survey Reminder", message);
}

 

if my answer has helped with your question, please mark my answer as accepted solution and give a thumb up.

 

Regards,

CB

Bhagya
Tera Contributor

I needed the functionality for the service portal. When the user login to the portal then the pop up should come