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

  • Community Member Profile Picture
    on at
    RE: How to set two option value in dynamics CRM?

    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.

  • Suggested answer
    Justinjose Profile Picture
    2,707 on at
    RE: How to set two option value in dynamics CRM?

    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

  • Suggested answer
    Shidin Haridas Profile Picture
    3,497 on at
    RE: How to set two option value in dynamics CRM?

    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.

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

🌸 Community Spring Festival 2025 Challenge Winners! 🌸

Congratulations to all our community participants!

Adis Hodzic – Community Spotlight

We are honored to recognize Adis Hodzic as our May 2025 Community…

Kudos to the April Top 10 Community Stars!

Thanks for all your good work in the Community!

Leaderboard > Microsoft Dynamics CRM (Archived)

#1
Mohamed Amine Mahmoudi Profile Picture

Mohamed Amine Mahmoudi 83 Super User 2025 Season 1

#2
Community Member Profile Picture

Community Member 52

#3
dkrishna Profile Picture

dkrishna 6

Overall leaderboard

Featured topics

Product updates

Dynamics 365 release plans