Quantcast
Channel: Microsoft Dynamics CRM Forum - Recent Threads
Viewing all articles
Browse latest Browse all 82002

Remove email recipient using javascript

$
0
0

I'm using Dynamics 365 online v9.1.

Where emails are linked to a case I want to change the From to be the support queue and make sure they're not a recipient.

The From change is working perfectly.

The To (and CC) checks are working when the email form loads. When the email record is saved, the queue is added back as a To recipient. I have my function registered on form load only, not save. However I can't see any reference to the function being called on save using Fiddler or Console.

writeToConsole("Cycle To");
if (tos.length > 0)//tos !== null && //works with or without null check
    for (i = 0; i < tos.length; i++) {
        var _to = tos[i];
        writeToConsole(_to);
        if (_to["id"].replace("{", "").replace("}", "") === queueId) {
            writeToConsole("Remove queue from To");
            tos.splice(i, 1);
            upTo = true;
        }
        else {
            writeToConsole("no match");
            writeToConsole(_to["id"]);
            writeToConsole(queue[0].id);
        }
    }
if (upTo) {
    writeToConsole("Update Tos");
    Xrm.Page.getAttribute("to").setValue(null);// doesn't seem to matter
    Xrm.Page.getAttribute("to").setValue(tos);
}



Viewing all articles
Browse latest Browse all 82002

Latest Images

Trending Articles



Latest Images