CRM 2011: Change sender when replying emails generates drafts in IE9 but not in IE7 RRS feed

  • Question

  • Hi!

    I need some help:-)

    We are changing the email sender on reply. The funny thing is that our solution works perfect with IE8(XP) and IE7(win7), but are "failing" with IE9(win7). The CRM server is untouched, the clients browsers are to be upgraded tol IE9(win7).

    What do I mean by failing; the user press reply and the sender is changed(by javascript) and after the email is sent there is an additional draft with the previous sender. That means the user have to delete the draft...

    Here's our javascript Form_onload function:

    function Form_onload() {

        var KUNDESERVICE_QUEUEID = '{7740F2FF-4826-43F3-9EAA-F5E0D84C0D9C}';

        var FORM_TYPE_CREATE = 1;
        var FORM_TYPE_UPDATE = 2;
        var FORM_TYPE_READ_ONLY = 3;
        var FORM_TYPE_DISABLED = 4;
        var FORM_TYPE_QUICK_CREATE = 5;
        var FORM_TYPE_BULK_EDIT = 6;

        var CRM_STATUSCODE_DRAFT = "1";
        var CRM_STATUSCODE_SENT = "3";
        var CRM_STATUSCODE_RECEIVED = "4";
        var CRM_STATUSCODE_SENDING = "7";
        var CRM_STATUSCODE_FAILED = "8";

        try {

            var formType = Xrm.Page.ui.getFormType();

            if (formType == FORM_TYPE_CREATE) {
                // new email.

            else if (formType == FORM_TYPE_UPDATE && Xrm.Page.getAttribute("statuscode").getValue() == CRM_STATUSCODE_DRAFT && isEmailDraftJustCreated()) {
                // reply to email.
                setTimeout(writeOutSignature, 250);
        catch (err) { alert(err.message); }

        function isEmailDraftJustCreated() {
            return (isForward == true || isReply == true || isReplyAll == true);
            //return typeof _deleteActionEnabled == "undefined" || (isForward == true || isReply == true || isReplyAll == true);

    BR Knut Myre

    Wednesday, August 14, 2013 2:39 PM

All replies

  • What rollup is your server on? And also can you post the 'setFromAddress' function so I can try and reproduce?



    If my response helped you find your answer please show your thanks by taking the time to "Mark As Answer" and "Vote As Helpful".

    Twitter LinkedIn Facebook Blog Magnetism

    Thursday, August 15, 2013 6:48 AM
  • Hi Paul!

    Rollup 7.

    Here's the function:

     function setFromAddress() {

            //Get GUID of logged user
            var userId = Xrm.Page.context.getUserId();

            SDK.REST.retrieveMultipleRecords("SystemUser", "$select=QueueId&$filter=SystemUserId eq guid'" + userId + "'",
                function (results) {
                    var firstResult = results[0];
                    if (firstResult != null) {

                        //Get Queue name and queueId
                        var queueId = results[0].QueueId.Id;
                        var queueName = results[0].QueueId.Name;
                        var queueLogicalName = results[0].QueueId.LogicalName;

                        //Create an array to set as the DataValue for the lookup control.
                        var lookupData = new Array();
                        //Create an Object add to the array.
                        var lookupItem = new Object();
                        //Set the id, typename, and name properties to the object.
                        lookupItem.id = queueId;
                        lookupItem.name = queueName;
                        lookupItem.typename = queueLogicalName;
                        lookupData[0] = lookupItem;


                    // Set the value of the lookup field to the value of the array.
                    // CRM 2011
                    Xrm.Page.getAttribute("from").setValue([{ id: queueId, name: queueName, entityType: queueLogicalName}]);

                function () { });

    BR Knut

    Thursday, August 15, 2013 7:01 AM
  • At first I was seeing the duplicate being created as you described; I would hit reply all, and then once the queue is set, save and close the form. But after it closes there would be another email behind it with the user as the from, and in draft state... But I've tried several times since and can not reproduce any more :(

    Are you able to consistently reproduce this? Is there anything in particular you are doing or setting to make it happen?


    If my response helped you find your answer please show your thanks by taking the time to "Mark As Answer" and "Vote As Helpful".

    Twitter LinkedIn Facebook Blog Magnetism

    Thursday, August 15, 2013 7:26 AM
  • Yes, it's happening consistently ... have not tried to reply twice(same email), is that what you tried?

    The customer are having their platform upgraded generally and they are "working as normal". Nothing particular...

    BR Knut

    Thursday, August 15, 2013 11:12 AM
  • I asked the customer to do a reply twice on same email, and yes it happens only once!
    Thursday, August 15, 2013 11:52 AM