Monday, June 29, 2015

How to convert textbox to hyperlink in MS CRM

function ConvertToLink(fieldName,urlFieldName) {
    var itemText = Xrm.Page.getAttribute(fieldName).getValue();
    if (itemText != null && itemText != '' && itemText != 'null') {
        var url = Xrm.Page.getAttribute(urlFieldName).getValue();
        var btn = "<a href='javascript: void(0);' onclick=\"window.open(\'" + url + "\', \'windowname1\');  return false;\" style='color:blue;text-decoration:underline !important'>" + itemText + "</a>";
        var ctrl = Xrm.Page.ui.controls.get(fieldName)._control;
        // Add the new button
        ctrl.get_element().innerHTML += btn;
        // Hide the textbox
        ctrl.get_element().firstChild.style.display = 'none';
    }
}

No comments:

Post a Comment

Get files of last hour in Azure Data Factory

  Case I have a Data Factory pipeline that should run each hour and collect all new files added to the data lake since the last run. What is...