Skip to main content

Notifications

Announcements

No record found.

Microsoft Dynamics CRM (Archived)

Send email request with custom entity

Posted on by 115

I just created an email request using C# to send email from system user into employee (custom entity). In the custom entity i added an email field type. When i run the program it says,

invalid party object type 10024

here the code

QueryExpression qe = new QueryExpression("lnkt_employee");
                //string[] cols2 = { "systemuserid", "domainname" };
                qe.Criteria = new FilterExpression();
                qe.Criteria.AddCondition("lnkt_codename", ConditionOperator.Equal, "ffatahillah");
                qe.ColumnSet = new ColumnSet(true);

                EntityCollection colect2 = _service.RetrieveMultiple(qe);

                EntityCollection toUserParty = new EntityCollection();
                toUserParty.EntityName = "lnkt_employee";

                foreach (Entity ent2 in colect2.Entities)
                {
                    string fullname = ent2.GetAttributeValue<String>("lnkt_codename");

                    Console.WriteLine("To : " + fullname);

                    Entity toParty = new Entity("activityparty");
                    EntityReference userParty = new EntityReference("lnkt_employee", ent2.Id);

                    toParty.Attributes.Add("partyid", userParty);

                    toUserParty.Entities.Add(toParty);

                }

                if (toUserParty.Entities.Count > 0)
                {
                    Email.Attributes.Add("to", toUserParty);
                }


Is it possible to fill the party with custom entity ?

*This post is locked for comments

  • Suggested answer
    a33ik Profile Picture
    a33ik 84,323 Most Valuable Professional on at
    RE: Send email request with custom entity

    Hello,

    It's not enough to add "email type" field to entity to enable it for emailing. What you should do is to open customization of entity and check "Sending email (If an email field does not exist, one will be created)" setting and then publish your entity.

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,280 Super User 2024 Season 2

#2
Martin Dráb Profile Picture

Martin Dráb 230,214 Most Valuable Professional

#3
nmaenpaa Profile Picture

nmaenpaa 101,156

Leaderboard

Featured topics

Product updates

Dynamics 365 release plans