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)

How to set two option value in dynamics CRM?

(0) ShareShare
ReportReport
Posted on by

Hi Experts,

When i am set two set value,they give me the error"Can not insert duplicate value".

And Code is:

selectedEntity["new_llc_identifybuyerorseller"] = getRate.GetAttributeValue<bool>("new_llc_buyerorseller");

How to solve this?

Please give me suggestion.

*This post is locked for comments

I have the same question (0)
  • Suggested answer
    Shidin Haridas Profile Picture
    3,499 on at

    Please debug and see if this is working:

    getRate.GetAttributeValue<bool>("new_llc_buyerorseller");

    Your code snippet to read the value of a 2-option attribute is right.

    so, the issue must be elsewhere, possibly if you are tyring to add the same key to the object again.

  • Suggested answer
    Justinjose Profile Picture
    2,707 on at

    Hi Yatish,

    Can you try following options.

    1. To test add hard coded value like this selectedEntity["new_llc_identifybuyerorseller"] = true;

    2. comment the line to check issue is not causing from elsewhere.

    Thanks

    Justin Jose

  • Community Member Profile Picture
    on at

    Hi

    Is it possible to get some more code?

    Shidin Haridas is talking about adding the same key to an entity twice could throw this error. I actually purposely tried this in a console application and the error you get for doing this is: System.ArgumentException: 'An item with the same key has already been added.'

    This is not the same error as you get. To identify what is causing you trouble, you may need to add more code.

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