Skip to main content

Notifications

Announcements

No record found.

Microsoft Dynamics CRM (Archived)

Accessing combination of keys as an alternate key to avoid duplicate record creation

Posted on by 795

Hi All,

I am creating a record using my own C# code. I have used emailaddress(text field) as an altenate key.But now, i want one more field to act as an alternate key(lookup field) But lookup fields can't be alternate keys.So, ow can i use the combination of both fields as an alternate key so that if same email addresses allows us to create a record only and only if the other field value is different.

Thanks for any help!

*This post is locked for comments

  • Verified answer
    CRM Beginner  Profile Picture
    CRM Beginner 795 on at
    RE: Accessing combination of keys as an alternate key to avoid duplicate record creation

    Thanks for the reply!! It worked..

  • gdas Profile Picture
    gdas 50,085 on at
    RE: Accessing combination of keys as an alternate key to avoid duplicate record creation

    Hi,

    does your problem is resolved?

  • Suggested answer
    Community Member Profile Picture
    Community Member Microsoft Employee on at
    RE: Accessing combination of keys as an alternate key to avoid duplicate record creation

    Hi,

    is ther a bug I don't see the different responses?

    What I would is to concatenate the email address and the string of the lookup.

    You should probably do it on a post event(create/update) and then update the record with the concatenated string/unique key

  • Suggested answer
    gdas Profile Picture
    gdas 50,085 on at
    RE: Accessing combination of keys as an alternate key to avoid duplicate record creation

    Hi,

    You need to set the value in on change event. How you are getting value please share your code.

  • CRM Beginner  Profile Picture
    CRM Beginner 795 on at
    RE: Accessing combination of keys as an alternate key to avoid duplicate record creation

    Yes, i am trying to do the same. But its returning null when i am accessing the lookup text

  • Suggested answer
    gdas Profile Picture
    gdas 50,085 on at
    RE: Accessing combination of keys as an alternate key to avoid duplicate record creation

    Hi,

    As dynamics CRM  does not support alternate keys for lookup. So in that case I would recommend create another single line text and make it as alternate key. When you create record at that time onchagne of lookup you will need to set lookup value/text in this  new single line text . If its found any duplicate it will give  error message .Hope this helps.

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

#2
Martin Dráb Profile Picture

Martin Dráb 230,214 Most Valuable Professional

#3
nmaenpaa Profile Picture

nmaenpaa 101,156

Leaderboard

Featured topics

Product updates

Dynamics 365 release plans