通过 JavaScript 在 Dynamics CRM 表单中创建静态 URL 超链接

Create static URL hyperlink in Dynamics CRM form via JavaScript

我想在表单上创建一个字段,用户可以单击该字段来引用位于静态位置的共享点文件。我创建了一个脚本并将其添加到页面,但我收到一条错误消息。有人可以帮忙吗?

脚本:

function createUrl () {
    var VersionSpreadsheet = "https://mycompany.sharepoint.com";
    Xrm.Page.data.entity.attributes.get("new_VersionSpreadsheet").setValue(VersionSpreadsheet);
}

错误:

One of the scripts for this record has caused an error. For more details, download the log file. TypeError: Cannot read property 'setValue' of null at createUrl

属性名称区分大小写,应全部小写。下面还有快捷清晰的版本。

function createUrl () {
    var VersionSpreadsheet = "https://mycompany.sharepoint.com";
    Xrm.Page.getAttribute("new_versionspreadsheet").setValue(VersionSpreadsheet);
}