- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
12-14-2023 09:37 AM
Hello Guys ,
I need a mail script to refer on embedding emojis in the notification and on click of the emojis it should redirect to the survey in the portal with the value selected .
I have referred to few community threads but they are using mail:to functionality which I don't require .
Looking forward for your response .
Solved! Go to Solution.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
12-15-2023 05:46 AM - edited 12-15-2023 05:50 AM
Hello @rish-123 ,
I was also facing the same issue, but I came-up with solution !!!
See the Email notification script below, it this, we using image(Need to upload image first in system UI > Images) and after clicking on that image, it is redirecting to page on portal(You can redirect to any page depending on your requirement).
Most important I am fetching Parameter Value as 'answer' at the end of url. So you can use this parameter for further use(For example: you can multiple smiley images with different parameters and depending on parameter value you can update records.)
*** Please modify the script depending on your requirement.
var image = '/smiley_good.png';
var instance = gs.getProperty("instance_name");
var link = "https://" + instance + ".service-now.com";
var asmt_ass_instance = new GlideRecord('asmt_assessment_instance');
asmt_ass_instance.get('trigger_id', current.sys_id);
var survey_ass_id = asmt_ass_instance.sys_id;
//redirecting to service portal page of Survey
var s_link = link + '/sp?id=custom_survey&instance_id=' + survey_ass_id + '&answer=' + 3;
var mailLink = '<a href="' + s_link + '"> <img src="' + image + '"></a>';
template.print(mailLink);
Kindly mark my answer as Correct and helpful based on the Impact.
Regards,
Siddhesh
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
12-15-2023 03:25 AM
Hi @rish-123
I doubt this can be achievable but have a look here
If my response proves useful, please indicate its helpfulness by selecting " Accept as Solution" and " Helpful." This action benefits both the community and me.
Regards
Dr. Atul G. - Learn N Grow Together
ServiceNow Techno - Functional Trainer
LinkedIn: https://www.linkedin.com/in/dratulgrover
YouTube: https://www.youtube.com/@LearnNGrowTogetherwithAtulG
Topmate: https://topmate.io/atul_grover_lng [ Connect for 1-1 Session]
****************************************************************************************************************
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
12-15-2023 05:46 AM - edited 12-15-2023 05:50 AM
Hello @rish-123 ,
I was also facing the same issue, but I came-up with solution !!!
See the Email notification script below, it this, we using image(Need to upload image first in system UI > Images) and after clicking on that image, it is redirecting to page on portal(You can redirect to any page depending on your requirement).
Most important I am fetching Parameter Value as 'answer' at the end of url. So you can use this parameter for further use(For example: you can multiple smiley images with different parameters and depending on parameter value you can update records.)
*** Please modify the script depending on your requirement.
var image = '/smiley_good.png';
var instance = gs.getProperty("instance_name");
var link = "https://" + instance + ".service-now.com";
var asmt_ass_instance = new GlideRecord('asmt_assessment_instance');
asmt_ass_instance.get('trigger_id', current.sys_id);
var survey_ass_id = asmt_ass_instance.sys_id;
//redirecting to service portal page of Survey
var s_link = link + '/sp?id=custom_survey&instance_id=' + survey_ass_id + '&answer=' + 3;
var mailLink = '<a href="' + s_link + '"> <img src="' + image + '"></a>';
template.print(mailLink);
Kindly mark my answer as Correct and helpful based on the Impact.
Regards,
Siddhesh
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
12-15-2023 08:33 AM
Thank you Siddhesh , It worked .
Quick question , is there a way to set the value in the portal when we click the emoji ?
Example - I clicked on Satisfied emoji and it redirects to the portal page with the emojis present , I want just ensure this value is selected there .
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
12-15-2023 11:48 AM - edited 12-15-2023 12:46 PM
For that you can pass url parameters. In my example I am passing the answer parameter. So you can use different parameters values for different emojis. And based on parameter values in portal client script/server script you can write your logic based on requirements.
See the below community thread for how to get url parameters.
https://www.servicenow.com/community/csm-forum/get-url-parameters-from-client-script/m-p/389334