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)

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

(0) ShareShare
ReportReport
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

I have the same question (0)
  • Suggested answer
    gdas Profile Picture
    50,091 Moderator on at

    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.

  • CRM Beginner  Profile Picture
    795 on at

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

  • Suggested answer
    gdas Profile Picture
    50,091 Moderator on at

    Hi,

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

  • Suggested answer
    Community Member Profile Picture
    on at

    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

  • gdas Profile Picture
    50,091 Moderator on at

    Hi,

    does your problem is resolved?

  • Verified answer
    CRM Beginner  Profile Picture
    795 on at

    Thanks for the reply!! It worked..

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