Find your people. Pick a challenge. Ship something real. The CreatorCon Hackathon is coming to the Community Pavilion for one epic night. Every skill level, every role welcome. Join us on May 5th and learn more here.

How to add a hyperlink in an email body

rakesh241
Giga Contributor

Hey all,

How to add a hyperlink in an email body that is to be sent as a notification:

my email body should look like:

Please click Manager dashboard to check for the pending work.

The Manager dashboard I need to show as a hyperlink, and obviously this codes is gonna be moved to prod instance, so I  need the current instance name to be appended there in the hyperlink. 

The URL of manager dashboard looks something like this:

https://abcdev.service-now.com/nav_to.do?uri=%2F$pa_dashboard.do%3Fdashboard%3D4ddcdbd59393220064f572edb67ffbd4

Please let me know how would I achieve this. I am trying to put that as gs.getProperty(Instance_name) in the email sctipt but doesn't work.

1 ACCEPTED SOLUTION

What is the result you are currently getting?

You should probably add "https://" to the start of the href attribute as well, but I doubt that's the issue.

I'm guessing it might be an issue with the single/double quotes.  Change the double-quotes surrounding "instance_name" with single-quotes and remove the quotes around "Pending Approval".  And you have an extra double quote just before
".service-now.com" that should be removed.

Try the following:

template.print('<a href="https://' + gs.getProperty('instance_name') + '.service-now.com/nav_to.do?uri=/$pa_dashboard.do%3Fdashboard%3Dc0a5b3d99353220064f572edb67ffb40">Pending Approval</a>');

View solution in original post

4 REPLIES 4

sai krishna10
Giga Guru

I think we can use <a> tag in notification body

 

<a href=''''>Manager dashboard</a>

Mark as helpful or correct based on the impact.

Yes that is what I want to know how would put it in the a href tag. Basically the syntax. And it should take the current instance name.

I am putting like:

template.print('<a href="'+gs.getProperty("instance_name") +' ".service-now.com/nav_to.do?uri=%2F$pa_dashboard.do%3Fdashboard%3Dc0a5b3d99353220064f572edb67ffb40">"Pending Approval"</a>');

 

Please correct me where it is wrong

What is the result you are currently getting?

You should probably add "https://" to the start of the href attribute as well, but I doubt that's the issue.

I'm guessing it might be an issue with the single/double quotes.  Change the double-quotes surrounding "instance_name" with single-quotes and remove the quotes around "Pending Approval".  And you have an extra double quote just before
".service-now.com" that should be removed.

Try the following:

template.print('<a href="https://' + gs.getProperty('instance_name') + '.service-now.com/nav_to.do?uri=/$pa_dashboard.do%3Fdashboard%3Dc0a5b3d99353220064f572edb67ffb40">Pending Approval</a>');

Yeah I had done the same and it worked. Thanks for the reply.