link to portal record in notification is not working properly

learn nv
Tera Contributor

Hi All,

I am trying to provide a clickable link to open the record in notification. But, it is not working. Below is the mail script code.

mail script code:

var url = gs.getProperty('glide.servlet.uri') + 'esc?id=order_status&table=' + current.sys_class_name + '&sys_id=' + current.sys_id;
    var linkText="View requests";

    template.print('<div style="display: inline-block; padding: 10px 10px; background-color: #0047AB; border-radius: 10px; cursor: pointer; text-decoration: none;" onclick="window.location=\'' + url + '\'">' + " <span style='color:white'>"+ linkText + "</span>\n"+ '</div>');
 
Notification Preview:
learnnv_0-1742374306057.png

Below are the problems:

1. 'View Requests' box is not responding. But, it is responding if i changed to url link instead of box.

2. Alignment of the box is not proper, how can i move this box to bit right side?

4 REPLIES 4

Ankur Bawiskar
Tera Patron
Tera Patron

@learn nv 

is that an image?

Why not have link itself?

If my response helped please mark it correct and close the thread so that it benefits future readers.

Regards,
Ankur
Certified Technical Architect  ||  9x ServiceNow MVP  ||  ServiceNow Community Leader

Hi Ankur, 

'View requests' should be a link which takes the user to corresponding record in portal when user clicked on it. 

Client want to display it as button box instead of normal link representation.

Ankur Bawiskar
Tera Patron
Tera Patron

@learn nv 

check this link on how to add image and have click functionality in email

Approve/Reject button in Approval notification 

If my response helped please mark it correct and close the thread so that it benefits future readers.

Regards,
Ankur
Certified Technical Architect  ||  9x ServiceNow MVP  ||  ServiceNow Community Leader

@learn nv 

Hope you are doing good.

Did my reply answer your question?

If my response helped please mark it correct and close the thread so that it benefits future readers.

Regards,
Ankur
Certified Technical Architect  ||  9x ServiceNow MVP  ||  ServiceNow Community Leader