Converting a URL into hyperlink in Work Notes

Kamy
Tera Contributor

Hello,

 

I have a requirement where I want to convert a URL that is added into Work Notes of an incident into Hyperlink. The users who will be adding these links will not have the capability to add HTML tags to the link before submitting. 

 

I have created a business rule before insert update and condition when work notes changes. Below is the script:

 

(function executeRule(current, previous /*null when async*/) {

// Add your code here
var exp = /(\b(https?|ftp|file):\/\/[-A-Z0-9+&@#\/%?=~_|!:,.;]*[-A-Z0-9+&@#\/%=~_|])/ig;
var linkTemplate = '[code]<a href="$1" target="_blank">$1</a>[/code]';
current.work_notes = current.work_notes.replace(exp, linkTemplate);
})(current, previous);

 

This code is working, however it shows like this below after clicking on Submit in Work Notes.

Kamy_0-1671128993916.png

I would just want the Hyperlink but not the URL text. 

Any insights on what the issue could be in the script would be great. I got this script from one of the community questions on a similar issue but do not have a solution for this.

 

Thank you!

9 REPLIES 9

even after doing that it does not work

@Veer 

Is this attribute working for you?


If I helped you with your case, please click the Thumb Icon and mark as Correct.


@Sebas Di Loreto  I tried the same but it is not working for me as well. I read it somewhere this is the way it can be used for putting the URL's@ in a field but I had no luck on this.


@Kamy  Please ignore the first solution provided.

Gayathri Ponse1
Tera Contributor

Hi Kamy,

 

Can you let us know whether you found fix? We have similar kind of requirement and couldn't able to remove text URL.

 

 

Thank you!

Sowmyasree2
Tera Contributor

Hi Kamy,

 

Can you let us know whether you found fix? We have similar kind of requirement and couldn't able to remove text URL.

 

 

Thank you!