web
You’re offline. This is a read only version of the page.
close
Skip to main content

Notifications

Announcements

No record found.

Community site session details

Community site session details

Session Id :
Microsoft Dynamics CRM (Archived)

Associate Two Entity Instances in Microsoft Dynamics CRM 2015 Online Using C#

(0) ShareShare
ReportReport
Posted on by 1,432

I am Associating Lead to Custom Entity the OutFile .txt not Generating code But their No Error in this Code

AssociateRequest areq = new AssociateRequest();
//Target is the entity that you are associating your entities to.
areq.Target = new EntityReference("lead", new Guid("bb8f43ac-ea7d-e411-80d7-80c16e644b9a"));

//RelatedEntities are the entities you are associating to your target (can be more than 1)
areq.RelatedEntities = new EntityReferenceCollection();
areq.RelatedEntities.Add(new EntityReference("new_callinglist", new Guid("ff0dedf6-9a80-e411-80d8-80c16e644b9a")));

//The relationship schema name in CRM you are using to associate the entities.
//found in settings - customization - entity - relationships

areq.Relationship = new Relationship("new_lead_new_callinglist");
//execute the request
service.Execute(areq);

*This post is locked for comments

I have the same question (0)
  • Verified answer
    Saroj Das Profile Picture
    3,355 on at

    hi KNK, Please look into this articles. This may help you.

    msdn.microsoft.com/.../gg309247.aspx

    h.t.h

    Saroj

  • KNK Profile Picture
    1,432 on at

    Hi Saroj When ever am calling my custom Entity in

    EntityReferenceCollection relatedEntities = new EntityReferenceCollection();

    relatedEntities.Add(new EntityReference9new_callinglist.EntityLogicalName,_new_callinglistId));

    showing an Error

    the name"new_callinglist doesnot Exist in Current Context

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

Responsible AI policies

As AI tools become more common, we’re introducing a Responsible AI Use…

Neeraj Kumar – Community Spotlight

We are honored to recognize Neeraj Kumar as our Community Spotlight honoree for…

Leaderboard > 🔒一 Microsoft Dynamics CRM (Archived)

#1
SA-08121319-0 Profile Picture

SA-08121319-0 4

#1
Calum MacFarlane Profile Picture

Calum MacFarlane 4

#3
Alex Fun Wei Jie Profile Picture

Alex Fun Wei Jie 2

Last 30 days Overall leaderboard

Featured topics

Product updates

Dynamics 365 release plans