Skip to main content

Notifications

Community site session details

Community site session details

Session Id : zILk6tvSf2TdQEHFsyahyw
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

Understanding Microsoft Agents - Introductory Session

Confused about how agents work across the Microsoft ecosystem? Register today!

Markus Franz – Community Spotlight

We are honored to recognize Markus Franz as our April 2025 Community…

Kudos to the March Top 10 Community Stars!

Thanks for all your good work in the Community!

Leaderboard

#1
WarrenBelz Profile Picture

WarrenBelz 146,702 Most Valuable Professional

#2
RandyHayes Profile Picture

RandyHayes 76,287 Super User 2024 Season 1

#3
Pstork1 Profile Picture

Pstork1 66,015 Most Valuable Professional

Leaderboard

Featured topics

Loading started