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';
    }
}

Comments

Popular posts from this blog

Workflow Activity Input and Output Parameters and Data Types in MS CRM 2013/15/16

Get Workflow Guid in Javascript using OData query

Convert Plugin to Sandbox mode,