- 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-18-2023 11:53 AM
Hello @rish-123 ,
Does this resolved your issue? If yes, please accept my reply as solution and close this thread!!!
This help a lot!!!! Please let me know......I am expecting to hear back from you 😊
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
12-20-2023 03:50 AM
One last question Siddhesh ,
How did you pass the parameter value and where did you right the client script ?
I referred the article and got an idea but confused on where this needs to be implemented . A screenshot would be helpful. Thanks
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
12-21-2023 02:32 AM
Hello @rish-123 ,
See the below piece of a code I am using in the server script of portal page. In this on I am using parameter which passed in Url. (example: answer , instance_id).
This kind of url you can build, refering the url you can easily see how to pass the parameter.
data.acknowledgementInstance = $sp.getParameter("instance_id");
data.acknowledgementInstanceAnswer = $sp.getParameter("answer");
data.acknowledgementSubmitted = 'no';
data.acknowledgementCompleted = 'no';
var acknowledgementInstance = data.acknowledgementInstance;
var acknowledgementInstanceAnswer = data.acknowledgementInstanceAnswer;
var instance = new GlideRecord('sn_compliance_policy_acknowledgement_instance');
instance.addQuery('sys_id', acknowledgementInstance);
instance.query();
if (instance.next()) {
if (instance.state == 1) {
if (acknowledgementInstanceAnswer == 0) {
instance.state = 3;
instance.update();
}
if (acknowledgementInstanceAnswer == 1) {
instance.state = 2;
instance.update();
}
Kindly mark the answer ✔️Correct or Helpful ✔️If it addresses your concern !!!
Regards,
Siddhesh
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
12-15-2023 08:42 AM
Thank you siddhesh ,
It worked .
Quick question - Is there a way to set the value in the portal survey when clicking the emoji from the notification ? Likes it needs to be selected .
Notification :
Portal: