Skip to main content

Notifications

Announcements

No record found.

Microsoft Dynamics CRM (Archived)

How to create Entity Refrence in COntact entity to Lean entity?

Posted on by 165

My code:

entity["parentleadid"] = new EntityReference("lead", {GUID});
 _crmConnector.service.Update(entity);

entity is Entity  {Contact}

But I have error:

'contact' entity doesn't contain attribute with Name = 'parentleadid' and NameMapping = 'Logical'.

 

What is wrong with it?

 

Thank you

 

UPD.


Code which game me field 'parentleadid':

 medatata has 'EntityMetadata' type

var lookupFields = metadata.Attributes
.Where(c => (
c.AttributeType == AttributeTypeCode.Lookup ||
c.AttributeType == AttributeTypeCode.Customer
))
.ToList();


*This post is locked for comments

  • Suggested answer
    Arun Vinoth Profile Picture
    Arun Vinoth 11,613 on at
    RE: How to create Entity Refrence in COntact entity to Lean entity?

    Error message is very clear. There’s no attribute in Contact entity with name parentleadid. Either OOB or custom.

    For sure there’s no OOB field with that name.

    docs.microsoft.com/.../contact

    If you have any custom attribute, then check for prefix, for ex new_parentleadid

    Regarding the metadata call, not sure if you are querying the right entity, right filter, right attribute. Share the full code or complete list you re getting in that .ToList() output

  • Shaminderpal Singh Profile Picture
    Shaminderpal Singh 1,565 on at
    RE: How to create Entity Refrence in COntact entity to Lean entity?

    Can you share your complete code ?

  • LeonardBertone Profile Picture
    LeonardBertone 165 on at
    RE: How to create Entity Refrence in COntact entity to Lean entity?

    this field 'parentleadid' was given me by SDK when I retrieven entities atrributes.

    Is this way is wrong ?

  • Suggested answer
    Shaminderpal Singh Profile Picture
    Shaminderpal Singh 1,565 on at
    RE: How to create Entity Refrence in COntact entity to Lean entity?

    Hi,

    There isn't any oob "parentleadid" field on contact, use "originatingleadid" in place of it.

    -Shaminder

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

#2
Martin Dráb Profile Picture

Martin Dráb 230,198 Most Valuable Professional

#3
nmaenpaa Profile Picture

nmaenpaa 101,156

Leaderboard

Featured topics

Product updates

Dynamics 365 release plans