Skip to main content

Notifications

Announcements

No record found.

Microsoft Dynamics 365 | Integration, Dataverse...
Suggested answer

CRM Plugin - Late-Bound works, Early-Bound Doesnt work

(0) ShareShare
ReportReport
Posted on by 10

When i use Late-Bound everything works just fine;

But when i  try to use Early-Bound nothing works (wether it is to update or create a completely new record) 

//Entities.Contact contact = new Entities.Contact();   this DOES NOT WORK 
Entity contact = new Entity("contact"); 
DateTime birthdate = DateTime.Parse(postImage["birthdate"].ToString());

double age = (double)(DateTime.Today.Year - birthdate.Year)   (double)(DateTime.Now.Month - birthdate.Month)/12;
//contact.cpr_age = age; DOESNT WORK
contact["cpr_age"] = age;
contact.Id = postImage.Id;
                
service.Update(contact);

i generated early bind using crmsvcutil exe with the command like in the documentation

and added the namespace, compiles fine no errors

but nothing happens in the CRM when i do the thing (for example here updating the age)

where could the problem be ?

i did not use toolbox to generate because the file does not compile from it (added nuget package of coreAssemblies)

pastedimage1644858589850v1.png

  • Suggested answer
    Bipin D365 Profile Picture
    Bipin D365 28,959 Super User 2024 Season 1 on at
    RE: CRM Plugin - Late-Bound works, Early-Bound Doesnt work

    Hi,

    It does not compile because you have only generate Entities file. You will also need to generate Optionset file to compile your code successfully.

    1541.CR1.PNG

    Hope this helps!

    Please mark my answer verified if this is helpful!

    Regards,

    Bipin Kumar

    Follow my Blog: xrmdynamicscrm.wordpress.com/

  • mtx2022 Profile Picture
    mtx2022 10 on at
    RE: CRM Plugin - Late-Bound works, Early-Bound Doesnt work

    the file generated form toolbox does not compile as it says missing namespaces even though i added the nuget package CoreAssemblies

    and i named the Project Plugin, then a dot, then the Entity name; thus i am using Entities.Contact

  • Suggested answer
    Bipin D365 Profile Picture
    Bipin D365 28,959 Super User 2024 Season 1 on at
    RE: CRM Plugin - Late-Bound works, Early-Bound Doesnt work

    Hi,

    Try to generate early bound  class using xrmtoolbox plugin -

    www.xrmtoolbox.com/.../

    Why have you used Entities.Contact??

    It shoud be only Contact...

    Please mark my answer verified if this is helpful!

    Regards,

    Bipin Kumar

    Follow my Blog: xrmdynamicscrm.wordpress.com/

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

Congratulations 2024 Spotlight Honorees

Kudos to all of our 2024 community stars! 🎉

Meet the Top 10 leaders for December

Congratulations to our December super stars! 🥳

Start Your Super User Journey

Join the ranks of our community heros! 🦹

Leaderboard

#1
André Arnaud de Calavon Profile Picture

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

#2
Martin Dráb Profile Picture

Martin Dráb 230,466 Most Valuable Professional

#3
nmaenpaa Profile Picture

nmaenpaa 101,156

Leaderboard

Product updates

Dynamics 365 release plans