Join the #BuildWithBuildAgent Challenge! Get recognized, earn exclusive swag, and inspire the ServiceNow Community with what you can build using Build Agent.  Join the Challenge.

Add emoji in email notification and redirect to the survey on click

rish-123
Tera Contributor

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 .

1 ACCEPTED SOLUTION

Siddhesh Gawade
Mega Sage
Mega Sage

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

View solution in original post

8 REPLIES 8

Dr Atul G- LNG
Tera Patron
Tera Patron

Hi @rish-123 

 

I doubt this can be achievable but have a look here

 

https://www.servicenow.com/community/developer-articles/embedding-emoticon-s-smiley-survey-in-email-...

*************************************************************************************************************
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]

****************************************************************************************************************

Siddhesh Gawade
Mega Sage
Mega Sage

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

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 . 

rish123_1-1702657995408.png

 

rish123_0-1702657972013.png

 

 

@rish-123 

 

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