Add Hyperlink Programmatically in the Note body within Dynamics 365

By | October 12, 2020

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

2 thoughts on “Add Hyperlink Programmatically in the Note body within Dynamics 365

  1. stef1996

    Hello!
    This solution is not working, is still showing as plain text and I also receive this Alert:
    This note has formatted text. Editing this note in legacy web client will clear all formatting. To keep the formatted text, please edit from timeline in Unified Interface.

    1. Inogic

      The option is not available in Power Platform configuration.

      Please find the new image from Classic configuration page.

      Power Platform Configuration

      Thanks!

Comments are closed.