简体   繁体   中英

Create static URL hyperlink in Dynamics CRM form via JavaScript

I would like to create a field on a form that users can click on to reference a sharepoint file that is in a static location. I created a script and added it to the page but I'm getting an error message. Can anyone please help?

Script:

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

Error:

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

The attribute names are case sensitive and it should be all lowercase. Also the shortcut and crisp version is below.

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

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM