Need to send custom Notification related to Survey without hardcoding URL / using System properties

Abhilasha G T
Tera Contributor

Hi Team,

1. I have created one custom Survey, for below use case,

* When incident is moves to closed, survey emails should triggered to caller

2. Created one custom notification on Incident table  like below 

AbhilashaGT_0-1735647853201.png

3. In the tab what it will contain i added one email script 

AbhilashaGT_1-1735647945455.png

4. email script written like below,

var surveyLink = new AssessmentUtils().getAssessmentInstanceURL(current.sys_id);
    var surveyUrl = '<a href="' + surveyLink + '">Take our survey</a>';
    template.print(surveyUrl);
 
5. Email is triggering and also caller can see the survey and update
    Error : as an admin am not able to see the survey i configured in the preview notification , once i click on the link it  showing 
AbhilashaGT_4-1735648506646.png

and also in the email logs , when i checked with preview email? same above error

 

How to resolve this issue?

 

 

1 ACCEPTED SOLUTION

Hello @Abhilasha G T 

 

The function you are using expects sys_id of the survey instance, screenshot of script for reference:

AhmmedAli_0-1735658761819.png

You will need to create notification on assessment instance table with condition as metric type as your Survey 

OR 

You can query assessment instance table to get sys_id of the assessment instance created once the incident is closed (assuming you have configured trigger condition of Survey when incident is closed) and pass that instance record sys_id to the function.

 

Thank you,

Ali

 

If I could help you with your Query then, please hit the Thumb Icon and mark my answer as Correct!!

Thank you,
Ali

View solution in original post

3 REPLIES 3

Ahmmed Ali
Mega Sage

Hello @Abhilasha G T 

 

This is expected as the survey widget checks if the survey is currently assigned to logged in user, irrespective of the roles. You can try impersonating the user to whom the survey is assigned and test.

 

Thank you,

Ali

 

If I could help you with your Query then, please hit the Thumb Icon and mark my answer as Correct!!

Thank you,
Ali

Hi Ali,

 

I  impersonating with the user with survey assigned , he can see the survey in the 

My Assessments and Surveys

AbhilashaGT_1-1735651887368.png

But he is not able to see the survey in the email logs> preview email, see the screenshot below,

 

 

AbhilashaGT_0-1735651832972.png

i need to fix this issue ? any solutions

 

Regards,

Abhilasha G T

Hello @Abhilasha G T 

 

The function you are using expects sys_id of the survey instance, screenshot of script for reference:

AhmmedAli_0-1735658761819.png

You will need to create notification on assessment instance table with condition as metric type as your Survey 

OR 

You can query assessment instance table to get sys_id of the assessment instance created once the incident is closed (assuming you have configured trigger condition of Survey when incident is closed) and pass that instance record sys_id to the function.

 

Thank you,

Ali

 

If I could help you with your Query then, please hit the Thumb Icon and mark my answer as Correct!!

Thank you,
Ali