CSS for links in email notifications

mdsannavulla
Kilo Guru

Hi All,

How to set the color for ${URI_REF} in email notifications. By default it is coming in blue color. I kept text color as red by using Rich HTML editor but it is coming as blue only in emails.

Any idea on this?

10 REPLIES 10

Hi Sannavulla,



Your HTML snippet seems to be all good. I checked with "Preview Notification" and its rendering red color text as expected.


Can you check your email notification on the browser (web version) and do inspect-element to see if has the css property. Just guessing if there is anything wrong with email client (ex: Outlook).



Thanks,


Manjul



In Preview HTML body also I am not getting the color which I kept.



find_real_file.png



In my email it is coming like below



find_real_file.png



The color of the incident number in preview HTML body and in email body are different....


Hi Sannavulla,



Could you please confirm that you have below HTML in your HTML Editor ?



<div>Short description: ${short_description}</div>


<div>Click here to view: <span style="color: #ff0000;">${URI_REF}</span></div>


<div>


<div><hr /></div>


</div>


<div>Comments:</div>


<div>${comments}</div>



The reason i'm not sure is because you don't seem to have a <a> tag in it, whereas the screenshot of the preview window you shared seem to have <a> tag. Also the Incident number seem to be clickable.


pastedImage_0.png



If it was a missing piece, then I think blue color underlined text is coming because of <a> tag text-decoration.



Here is how your html should be:



<div>Short description: ${short_description}</div>


<div>Click here to view: <i><a style="color: #ff0000; text-decoration: none;" href="#">${URI_REF}</a></i></div>


<div>


<div><hr /></div>


</div>


<div>Comments:</div>


<div>${comments}</div>




Hope this help!


Manjul


Hi Sannavulla,



Please ignore my previous reply, I didnt knew that URI_REF is a pre compiled link which is being append in the <span>.


As Gurpreet suggested, you may have to tweak URI_REF.



When it comes to style   the text, just make sure to add "<a style="color: #ff0000; text-decoration: none;">....</a>"



-Manjul




Gurpreet07
Mega Sage

Its very hard to use css in emails. Only inline style tag works well.


URI_REF is a pre compiled link with no css applied of link text color. By this we i mean to say that URI REF will get replaced with a link like below


URI_REF   = <a href="example.com">TEXT</a>


Now , if you i don't know if it will work if you again use URI_REF in href attribute of 'a' tag.


Here you may need to create your own custom link with inline style tag to change link text


<mail_script>


var baseUrl = gs.getProperty('glide.servlet.uri');


template.print('<a style="color:red;" href="'baseUrl+current.getTableName()+'.do?sys_id='+current.sys_id+'">'+current.number+'</a>');


</mail_script>