Skip to main content

Notifications

Community site session details
Power Apps - Microsoft Dataverse
Answered

Dataverse Custom API Alternate key

Like (0) ShareShare
ReportReport
Posted on 20 Oct 2022 19:22:42 by 16

Hi,
Is it possible to use alternate key on custom api when input parameter is type of Entity Reference. Then in payload to custom api call instead of entity reference in form of table name and record id use, alternate key from source table.

example payload:

{
 "contactid": {
 "@odata.type": "Microsoft.Dynamics.CRM.contact",
 "customalternatekey" : "uniquevalue01"
 }
}

 

C# example call:

EntityReference contactIdKey= new EntityReference("contact", "customalternatekey", "uniquevalue01");
 OrganizationRequest request = new OrganizationRequest("new_apitest")
 {
 Parameters =
 {
 ["contactid"] = contactIdKey,
 
 }
 };

 var response = client.Execute(request);

 

Categories:
  • a33ik Profile Picture
    3,304 Most Valuable Professional on 21 Oct 2022 at 13:28:50
    Re: Dataverse Custom API Alternate key

    Thanks for the interesting discovery! Never thought to use the alternate key that way!

  • Guido Preite Profile Picture
    1,488 Super User 2024 Season 1 on 21 Oct 2022 at 07:16:12
    Re: Dataverse Custom API Alternate key

    thanks for the confirmation!

  • Verified answer
    BartoszP Profile Picture
    16 on 21 Oct 2022 at 07:13:23
    Re: Dataverse Custom API Alternate key

    I checked it again on morning and it was issue with my plugin that give error with dictionaries, and I was almost sure it was corelated with payload data.

    So alternate key for custom API are working.

  • Guido Preite Profile Picture
    1,488 Super User 2024 Season 1 on 20 Oct 2022 at 20:26:27
    Re: Dataverse Custom API Alternate key

    interesting question, honestly I never tried but I don't think it's possible. Did you try and got a specific error?

    EDIT: user confirmed is possible

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

Announcing the Engage with the Community forum!

This forum is your space to connect, share, and grow!

🌸 Community Spring Festival 2025 Challenge Winners! 🌸

Congratulations to all our community participants!

Warren Belz – Community Spotlight

We are honored to recognize Warren Belz as our May 2025 Community…

Leaderboard > Power Apps - Microsoft Dataverse

#1
mmbr1606 Profile Picture

mmbr1606 22 Super User 2025 Season 1

#2
stampcoin Profile Picture

stampcoin 19

#3
Michael E. Gernaey Profile Picture

Michael E. Gernaey 15 Super User 2025 Season 1

Overall leaderboard

Featured topics

Loading started
Loading started