Skip to main content

Notifications

Microsoft Dynamics CRM (Archived)

How to send email to a Queue?

Posted on by Microsoft Employee

Hi,

I want to send email to the Team. A queue is associated to that team. 

In javascript, I can retrieve the Queue Id(guid). Now, my question is how should I set queue to the "to" field of the email.

Currently I am using below code but it throws error "Lookup control error" because I don't know how to set queue id. It works fine if I send email to single email address and not the team.

var partyRequired = Xrm.Page.getAttribute("to");
// Create new array
var partlist = new Array();
partlist[0] = new Object();
partlist[0].id = id; //Guid (i.e., Guid of User or Contact etc)
try
{
partlist[0].name = recipientEntity.attributes["emailaddress1"].value;
}
catch (exc)
{
try
{
partlist[0].name = recipientEntity.attributes["internalemailaddress"].value;
}
catch (exc)
{
partlist[0].name = "";
}
}
partlist[0].entityType = entityType; //entity schema name of account or contact
partyRequired.setValue(partlist);

*This post is locked for comments

  • Community Member Profile Picture
    Community Member Microsoft Employee on at
    RE: How to send email to a Queue?

    Thanks Aric. Solved my problem.

  • Suggested answer
    Aric Levin Profile Picture
    Aric Levin 30,188 on at
    RE: How to send email to a Queue?

    The following should work:

    var partyRequired = Xrm.Page.getAttribute("to");

        var partlist = new Array();

        partlist[0] = new Object();

        partlist[0].id = Id; //Guid of Queue

        partlist[0].name = "Name"; // Name of Queue

        partlist[0].entityType = "queue";

        partyRequired.setValue(partlist);

    Hope this helps.

Under review

Thank you for your reply! To ensure a great experience for everyone, your content is awaiting approval by our Community Managers. Please check back later.

Helpful resources

Quick Links

December Spotlight Star - Muhammad Affan

Congratulations to a top community star!

Top 10 leaders for November!

Congratulations to our November super stars!

Tips for Writing Effective Suggested Answers

Best practices for providing successful forum answers ✍️

Leaderboard

#1
André Arnaud de Calavon Profile Picture

André Arnaud de Cal... 291,253 Super User 2024 Season 2

#2
Martin Dráb Profile Picture

Martin Dráb 230,188 Most Valuable Professional

#3
nmaenpaa Profile Picture

nmaenpaa 101,156

Leaderboard

Featured topics

Product updates

Dynamics 365 release plans