locked
CRM 2013 Outlook client Home Page Grid button doesn't download mail merge document RRS feed

  • Question

  • Hi,

    I have written below javascript that fires on click of custom button added on home page grid in Ribbon. It is working fine in CRM but not working in Outlook client. It executes properly without error in outlook client... I have added some debug info so it executes properly but doesn't download the mail merge document.

    I have added button on form as well so it works fine in both outlook client and CRM. In case of Home Page grid it is not working in Outlook client.

    // For Mail Merge button

    function GridRoadMailMergeSelected(selectedIds, objectTypeCode) {

    var serverUrl = getClientUrl();

    if (selectedIds == null || selectedIds == "") {
        return;
    }

    var WinSettings = "center:yes;resizable:no;dialogHeight:600px;dialogWidth:600px";
    var d1 = document.createElement("div");

    document.body.appendChild(d1);
    d1.innerHTML = '<form id="downloadMailMerge" name="downloadMailMerge" method="post"> \<input type="hidden" id="ids" name="ids" value="' + selectedIds + '" />  /> \<input type="hidden" id="gridxml" name="gridxml" value="" /> \<input type="hidden" id="layoutxml" name="layoutxml" /> \</form>';

    var nw = window.showModalDialog(serverUrl + "/_controls/lookup/lookupsingle.aspx?class=MailMergeTemplateGlobal&objecttypes=9106&browse=0&parentType=" + objectTypeCode + "&languagecode=1033&ShowNewButton=0&ShowPropButton=0&DefaultType=9106", null, WinSettings);

    if (nw == null) {
        document.body.removeChild(d1);
        return;
    }

    if (JSON.parse(nw).items == null) {
        return;
    }

    var json = JSON.parse(nw).items;

    if (json == null) {
        document.body.removeChild(d1);
        return;
    }

    var f = document.getElementById("downloadMailMerge");

    f.action = serverUrl + "/tools/mailmerge/download.aspx?languageid=1033&mergetype=0&otc=" + objectTypeCode + "&templateid=" + json[0].id;

    f.submit();

    document.body.removeChild(d1);
    }

    NOTE: It is working fine in CRM but not working in outlook client for Home Page Grid button.

    Thanks!

    Monday, June 2, 2014 7:24 AM

All replies