Skip to main content

Notifications

Announcements

No record found.

Community site session details

Community site session details

Session Id :
Microsoft Dynamics CRM (Archived)

Person entity and opportunity entity "web services"

(0) ShareShare
ReportReport
Posted on by Microsoft Employee

Hi All,

I'm using web services to create records through person entity but there is an embedded opportunity entity section for program level and entry term.

How can I access them in my code becuase I tried this and it gave me eror , field doesnt exist in person form.

       account.Attributes["elcn_anticipatedentrytermid"] = new EntityReference("elcn_datatel_academicterm_opportunity_anticipatedentrytermid", new Guid("232ad52b-a648-e311-97b2-005056ae44f4"));

Any help will be so appreciated 

*This post is locked for comments

  • Suggested answer
    Nausher Sayeed Profile Picture
    Nausher Sayeed 522 on at
    RE: Person entity and opportunity entity "web services"

    If I am not wrong you want to access the opportunity record for the person record, then you can use below code

    QueryExpression queryExpression = new QueryExpression { };

                   queryExpression.Criteria.AddCondition (elcn_anticipatedentrytermid, ConditionOperator.Equal, Your GUID);                

                   queryExpression.EntityName = oppurnity;

                   ColumnSet attributes = Your columns;

                   queryExpression.ColumnSet = attributes;

                   entityCollection = _crmAgent.RetrieveMultiple (queryExpression);

  • Suggested answer
    Nausher Sayeed Profile Picture
    Nausher Sayeed 522 on at
    RE: Person entity and opportunity entity "web services"

    This is the snipt that may work for you:

    //First is created a new contact

    Entity contact = new Entity("contact");

    contact.Attributes["firstname"] = "ContactFirstName";

    contact.Attributes["lastname"] = "ContactLastName";

    Guid contactId = _orgService.Create(contact, null);

    //Then assign the contact to an account.

    Entity account = new Entity("account");

    account["name"] = "Test Account1";

    EntityReference primaryContactId = new EntityReference("contact", contactId);

    account["primarycontactid"] = primaryContactId;

  • Community Member Profile Picture
    Community Member Microsoft Employee on at
    RE: Person entity and opportunity entity "web services"

    Sorry I wasn't clear, 

    yes there is opportunity grid in person entity form.

    Rergards

  • Inogic Profile Picture
    Inogic 438 on at
    RE: Person entity and opportunity entity "web services"

    We are not clear with your question, we are confuse with the terms that you have use to explain the question. By the term opportunity section we mean that you have an opportunity entity grid inside Person entity form.

    So one person can have multiple opportunities. And you want access those opportunities of that person.

    Is that correct?

    It would be helpful if you explain with screenshot.

    Thanks!

  • Community Member Profile Picture
    Community Member Microsoft Employee on at
    RE: Person entity and opportunity entity "web services"

    Than you for the answer,

    The problem is we have a small section opportunity entity inside person entity in form called"new prospect students".

    How can I point my code to that section like

    account.Attributes["opportunity-prorgam name"] = new EntityReference("?????", new Guid("232ad52b-a648-e311-97b2-005056ae44f4"));

    Thanks alot

  • prt33k Profile Picture
    prt33k 6,907 on at
    RE: Person entity and opportunity entity "web services"

    Hi.. Can you give the whole code? Also the exact error...

    Seeing the above line I think elcn_datatel_academicterm_opportunity_anticipatedentrytermid is a relationship entity(n:n) while you are trying to set that to a custom entity which is throwing error.

    Shouldnt it be

    account.Attributes["elcn_anticipatedentrytermid"] = new EntityReference("elcn_anticipatedentryterm", new Guid("232ad52b-a648-e311-97b2-005056ae44f4"));

    Thanks,

    PS

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

Announcing Our 2025 Season 1 Super Users!

A new season of Super Users has arrived, and we are so grateful for the daily…

Vahid Ghafarpour – Community Spotlight

We are excited to recognize Vahid Ghafarpour as our February 2025 Community…

Tip: Become a User Group leader!

Join the ranks of valued community UG leaders

Leaderboard

#1
André Arnaud de Calavon Profile Picture

André Arnaud de Cal... 292,516 Super User 2025 Season 1

#2
Martin Dráb Profile Picture

Martin Dráb 231,399 Most Valuable Professional

#3
nmaenpaa Profile Picture

nmaenpaa 101,156

Leaderboard

Featured topics

Product updates

Dynamics 365 release plans