Add Hyperlink Programmatically in the Note body within Dynamics 365

Sending
User Review
0 (0 votes)

Introduction

We know that Notes description is now Rich Text type, so it can support a wide range of formatting.

Recently we had a requirement to add a hyperlink in the note body. But, while doing this we faced one issue -by just wrapping the link in an anchor tag we were not able to make the text clickable.

We had to make the below link clickable.

Add hyperlink programmatically in the Note body

Initially, we just wrapped the link in an Anchor text and thought this should make it clickable. However, we saw that instead of making it clickable, the entire content is getting added in plain text as shown in the below screenshot.

Add hyperlink programmatically in the Note body

In order to resolve this issue, we figured out that we need to wrap our HTML content within a div tag and then add it in the Note body.

Add hyperlink programmatically in the Note body

So to solve this we needed to add an anchor tag with div as follows:

note[“notetext”] = “<div data-wrapper=’true’ style=’font-size:14px;font-family:’Segoe UI’,’Helvetica Neue’,’sans-serif’;’><div><a href=’” + link + “‘  target=’_blank’>’” + name + “‘</a></div></div>”;

Add hyperlink programmatically in the Note body

Conclusion

By using the workaround of wrapping HTML content within a div tag and then adding it in the Note body, hyperlinks can be added programmatically in the Note body