Hello,
I have a JavaScript runtime error after updating to Dynamics CRM 2015 Update 1.
My custom JavaScript is validated and passed the validation done through CRM 2015 Custom Validation Tool. As specified below, when the JavaScript run on page load, it grabs the single line text control and changes it to a hyperlink.
Here the code:
// JavaScript source code
function
ConvertTfsItemFieldToLink() {
//Get URL
var itemInputId = Xrm.Page.data.entity.attributes.get("control_name").getValue()
var baseUrl = "";
var url = baseUrl + itemInputId;
var ctrl = Xrm.Page.ui.controls.get("control_name");
//Get contol fist HTM element
var elem = ctrl.get_chromeElement()[0]
if (itemInputId != null) {
Xrm.Page.data.entity.attributes.get("Control_Name").setValue(itemInputId);
var btn = "<a href='javascript: void(0);' onclick=\"window.open('" + url + "'); return false; \" style='color:blue;text-decoration:underline !important'>" + itemInputId + "</a>";
// Add the new button
elem.innerHTML = btn;
}
else {
Xrm.Page.data.entity.attributes.get("Control_Name").setValue(null);
elem.innerHTML ='<span/>';
}
}
The script throws the following error:
TypeError: Object doesn't support property or method 'get_chromeElement'
at ConvertTfsItemFieldToLink (https://virtcrmsandbox2014.crm.dynamics.com/%7B635732137750002040%7D/WebResources/new_TFS_WorkItem_Case_Integration?ver=977649996:12:5)
at eval code (eval code:1:1)
at RunHandlerInternal (https://virtcrmsandbox2014.crm.dynamics.com/form/ClientApiWrapper.aspx:142:1)
at RunHandlers (https://virtcrmsandbox2014.crm.dynamics.com/form/ClientApiWrapper.aspx:101:1)
at ExecuteHandler (https://virtcrmsandbox2014.crm.dynamics.com/form/ClientApiWrapper.aspx:78:1)
at $Av_1 (https://virtcrmsandbox2014.crm.dynamics.com/_static/form/formcontrols.js?ver=977649996:2935:17)
at executeHandler (https://virtcrmsandbox2014.crm.dynamics.com/_static/form/formcontrols.js?ver=977649996:2881:13)
at executeHandlerByDescriptor (https://virtcrmsandbox2014.crm.dynamics.com/_static/form/formcontrols.js?ver=977649996:2912:13)
at Anonymous function (https://virtcrmsandbox2014.crm.dynamics.com/_static/form/formcontrols.js?ver=977649996:2920:13)
at Anonymous function (https://virtcrmsandbox2014.crm.dynamics.com/_common/global.ashx?ver=977649996:22662:109474)
I know that get_chromeElement may be removed from Control API.
Is there anyway I can resolve that.
Thanks.
Yoyo
*This post is locked for comments
I have the same question (0)