Skip to main content

Notifications

Announcements

No record found.

Microsoft Dynamics CRM (Archived)

Updated Early bound class file with new password and code will no longer compile

Posted on by Microsoft Employee

For several years, we have been using a stable application to update a large number of files.  We recently updated our passwords and needed to update the early bound class with the CrmSvcUtil.  After adding the early bound class file to the application, we receive errors like:

- Operator '==' cannot be applied to operands of type 'Microsoft.Xrm.Sdk.OptionSetValue' and 'int'

- Cannot implicitly convert type 'int' to 'Microsoft.Xrm.Sdk.OptionSetValue'

Any ideas what we're doing wrong?

*This post is locked for comments

  • Suggested answer
    ScottDurow Profile Picture
    ScottDurow 50,177 on at
    RE: Updated Early bound class file with new password and code will no longer compile

    Hi,

    The latest early bound generator does this by default. Perhaps you could download the older sdk and use that to generate your code.

    Hope this helps

  • ram r Profile Picture
    ram r on at
    RE: Updated Early bound class file with new password and code will no longer compile

    With the new early bound classes we might have replaced something like some existing custom code or it could be something related to version. Not sure about the root cause.

    As Alex suggested, the issue's fix is straight forward, append ".Value" to the optionset fields which will return a nullable integeter(int?) and this should solve the issue.

  • Suggested answer
    ashlega Profile Picture
    ashlega 34,475 on at
    RE: Updated Early bound class file with new password and code will no longer compile

    Hi,

     you definitely cannot compare OptionSetValue to int - have to do it slightly differently:

     OptionSetValue val = ...

     if(val.Value == 123) {}

     No idea what has changed, but it seems to be easy to fix..

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

#2
Martin Dráb Profile Picture

Martin Dráb 230,188 Most Valuable Professional

#3
nmaenpaa Profile Picture

nmaenpaa 101,156

Leaderboard

Featured topics

Product updates

Dynamics 365 release plans