Survey in Service Portal
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎03-07-2024 09:21 AM
Hi All,
I have requirement to trigger a survey to all the users who have accessed the Service Portal yesterday.
I have created a scheduled script execution which runs every 24 hrs.
The logic here is, it will recalculate the recipient list which has accessed the survey yesterday and then trigger the survey to them.
I need to put the wait time of 2 mins so that first the recipient's list get recalculated and then the survey gets triggered after 2 mins.
Can someone plz tell how to do it.
//Recalculate the Recipient's List in the Survey
gs.log('Job Started for recalculating the recipient list','SP Survey');
var portalRecipentListSysid=''; //Will store the sys_id of the Recipient List named-'Survey Recipient List who accessed the survey yesterday'
var surveyId ='';//Will store the sys_id of the Survey
var newUserRecipientList=[];
var grRecipientsList = new GlideRecord('sn_publications_recipients_list');
portalRecipentListSysid = 'bb11c0c81b244e506194da07b04bcb3e'; // This is the GUID value of the Recipient List named-'Survey Recipient List who accessed the survey yesterday'
if (grRecipientsList.get(portalRecipentListSysid)) {
newUserRecipientList= new sn_publications.RecipientsListApi().refreshRecepientList(grRecipientsList);
}
gs.log('New Calculated value of Users Recipient List ' + newUserRecipientList, 'SP Survey');
//Trigger the survey once the recipient list is generated
surveyId = '56274b7c87a8c25080f2edf83cbb351c';
new SNC.AssessmentCreation().createAssessments(surveyId);
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎03-07-2024 09:29 AM
Hi @Rooma1 ,
There is an OOTB table "ua_sp_usage" which has user details, start and end times.
If I could help you with your Query then, please hit the Thumb Icon and mark it as Correct !!
Thanks & Regards,
Sumanth Meda
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎03-07-2024 09:34 AM
Yeah, i know there is a OOB table -'ua_sp_usage' which stores the every session of the user who access the SP.
but the requirement here is: script should wait to trigger the survey till the recipient list gets calculated. How to include the wait time in the script?
Can I use gs.sleep() in the code?
Thanks,
Rooma
Rooma