locked
CRM 2011: remove email recipient through javascript RRS feed

  • Question

  • Hi,

    I'm trying to remove an email recipient from the "To" field in the email entity whenever a user clicks reply to all.

    Can this be accomplished by javascript, if so, how can I do it please?

    Thanks,

    Darren


    Darren Mercieca

    Wednesday, November 20, 2013 4:48 PM

All replies

  • The main problem here is that there is no perfect method to track if you are creating new email or replying existing email. But I hope you can implement your requirement by just writing js code to make this field null and call your function on load of email form.


    Our Website | Our Blog | Follow US | My Facebook Page | Microsoft Dynamics CRM 2011 Application Design
    Make sure to "Vote as Helpful" and "Mark As Answer",if you get answer of your question.

    Wednesday, November 20, 2013 4:56 PM
    Moderator
  • If its in the onLoad of the form that fine for me regardless if its a new email or a reply.

    I just need to know how I can remove a recipient from the "To" list with js.

    Can anyone help me please?


    Darren Mercieca

    Thursday, November 21, 2013 9:34 AM
  • Hi,

    You could try following code in Email entity Form onload event 

    function RemoveRecipients() {
        Xrm.Page.getAttribute("to").setValue(null);
        Xrm.Page.getAttribute("cc").setValue(null);
        Xrm.Page.getAttribute("bcc").setValue(null);
    }


    Hope this helps. If you get answer of your question, please mark the response as an answer and vote as helpful !
    Vikram !

    Thursday, November 21, 2013 9:39 AM
  • Hi Vikram,

    I would like to remove only 1 of the recipients in the To partylist not all of them.

    Thanks


    Darren Mercieca

    Thursday, November 21, 2013 10:05 AM
  • Hi Darren,

    Try like as below :

    if (Xrm.Page.getAttribute("to").getValue() != null) {
        var _List = Xrm.Page.getAttribute("to").getValue();
        if (_List.length > 0) {
            for (a = 0; a < _List.length; a++) {
               // remove recipient and create new list array to store new list
            }
            Xrm.Page.getAttribute("to").setValue(null);
            Xrm.Page.getAttribute("to").setValue(your new list);
        }
    }


    Hope this helps. If you get answer of your question, please mark the response as an answer and vote as helpful !
    Vikram !

    Thursday, November 21, 2013 10:24 AM