Hi folks,
there is a requirement to remove a specific email address from "To" field which has a list of email addresses using Javascript.
i have done this to remove a specific mail but this is not working. Please help me in this regards.
var formContext = executionContext.getFormContext();
var toParty = Xrm.Page.getAttribute("to").getValue();
var partyListArray = new Array();
for (var indx = 0; indx < toParty.length; indx++) {
var email = getParticipantEmail(
toParty[indx].entityType,
toParty[indx].id
);
if (email != "test@test.com") {
partyListArray[indx] = new Object();
partyListArray[indx].id = toParty[indx].id;
partyListArray[indx].name = toParty[indx].name;
partyListArray[indx].entityType = toParty[indx].entityType;
}
}
Xrm.Page.getAttribute("to").setValue(null);
Xrm.Page.getAttribute("to").setValue(partyListArray);