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 365 | Integration, Dataverse...
Answered

Issue Creating a Case in Power Apps Canvas App – “You must specify a contact or account” Error

(4) ShareShare
ReportReport
Posted on by 8

Hello everyone, I’m building a Power Apps Canvas App to create new Cases in Dataverse (the standard “incident” entity in Dynamics 365). Here’s what I’m experiencing:

 

  1.  

    Mandatory Customer Field

     

    • In the Cases table (called “Casi” or “Caso” in my environment, but logically it’s incident), there is a Customer field (_customerid_value) that’s System Required.

    • Every time I submit the form, I get the error:
       

      “Casi failed: You must specify a contact or account.”


    • I understand that this means the system expects either an Account or a Contact for that Customer field.


    •  

  2.  

    Attempts with SubmitForm

     

    • I added a Combo Box for Client/Customer pointing to the Account table.

    • In the form’s data card for _customerid_value, I tried setting Update with both:

      • @odata.type
         
        {
        '@odata.type': "#Microsoft.Dynamics.CRM.account",
        accountid: ComboBox1.Selected.accountid
        }

      • @odata.bind
         
        {
        'customerid_account@odata.bind': "/accounts(" & ComboBox1.Selected.accountid & ")"
        }

      • However, it still fails with the same “You must specify a contact or account” message.


      •  


    •  

  3.  

    Label to Display the GUID

     

    • To confirm the selected Account GUID, I placed a Label control on the screen and set its Text property to:
       
      ComboBox1.Selected.accountid

    • It displays a valid GUID (for instance: d253fa15-e7f5-ef11-be21-003248a356b7), so I know the Combo Box is returning the correct ID.


    •  

  4.  

    Attempts with Patch

     

    • I also tried Patch() instead of SubmitForm(), for example:
       
      Patch(
      Caso, // or "Casi", the data source
      Defaults(Caso),
      {
      'Titolo caso': TitleTextInput.Text,
      'Priorità': PriorityComboBox.Selected.Value,
      ...
      'customerid_account@odata.bind': "/accounts(" & ComboBox1.Selected.accountid & ")"
      }
      );
       

      • I made sure the table name and column names were correct (sometimes “Caso” vs. “Casi,” or “incident” as the logical name).

      • The GUID from ComboBox1.Selected.accountid is retrieved correctly (as shown in the label).

      • But the same error persists, indicating that the system does not accept the account reference.


      •  


    •  

  5.  

    Relationship Name

     

    • I tried finding the relationship name (e.g., customerid_account) via SolutionsCasoRelationships, but the standard “Case” entity is managed, so no relationships show up in the modern UI.

    • Normally, the default relationship names are customerid_account or customerid_contact for the Customer field on Case.


    •  

  6.  

    Other Details

     

    • I confirmed that “Litware S.p.A. (esempio)” actually exists in Account and has a valid GUID.

    • I’ve tried all suggestions, including using If(IsBlank(ComboBox1.Selected), Blank(), …) in the card’s Update property, or using a label to display ComboBox1.Selected.accountid.

    • Every approach leads to the same error message at submission.


    •  


  7.  
 

Question:

How can I successfully specify the Customer (contact or account) on a “Case” in Dynamics 365/Dataverse using a Canvas App? Why does the system still throw “You must specify a contact or account” even though I’m passing a valid Account GUID with @odata.bind or @odata.type?

 

Any guidance or best practices on properly populating _customerid_value in a Canvas App—especially for the incident (Case) entity—would be greatly appreciated.

 

Thank you!

I have the same question (1)
  • Verified answer
    Daivat Vartak (v-9davar) Profile Picture
    7,835 Super User 2025 Season 2 on at
    Hello CU12030941-0,
     
    You've done a thorough job troubleshooting, and you're very close to the solution! The issue you're facing is a common one when working with polymorphic lookup fields in Dataverse (like the "Customer" field on the Case entity) using Canvas Apps.
     
    Here's a breakdown of the problem and the correct approach:
     
    Understanding the Problem:
    • Polymorphic Lookup:
      • The "Customer" field is polymorphic, meaning it can reference either an Account or a Contact.
      • This requires you to specify not only the GUID of the record but also the entity type.
    • OData Binding:
      • While @odata.bind is the correct approach, you need to use the correct format for polymorphic lookups.
     
    The Solution:
    The key is to include the entity set name (either "accounts" or "contacts") in the @odata.bind string.
    Here's the corrected Patch() statement:
     
    Code snippet (Example)
    Patch(
        Caso, // or "Casi", the data source
        Defaults(Caso),
        {
            'Titolo caso': TitleTextInput.Text,
            'Priorità': PriorityComboBox.Selected.Value,
            // ... other fields ...
            'customerid_account@odata.bind': "/accounts(" & ComboBox1.Selected.accountid & ")"
        }
    );

     
    Explanation:
    • 'customerid_account@odata.bind': "/accounts(" & ComboBox1.Selected.accountid & ")":
      • This correctly specifies the entity set name ("accounts") followed by the GUID of the selected account.
     
    Key Points:
    1. Entity Set Name:
      • Always include the entity set name ("accounts" or "contacts") in the @odata.bind string for polymorphic lookups.
    2. GUID Format:
      • Ensure the GUID is in the correct format (e.g., "d253fa15-e7f5-ef11-be21-003248a356b7").
    3. Combo Box Selection:
      • Verify that the Combo Box is correctly returning the selected account's GUID.
     
    If you want to support Contacts as well:
    If you need to support selecting both Accounts and Contacts in your Combo Box, you'll need to:
    1. Combine Data Sources:
      • Combine the Accounts and Contacts tables into a single collection or view that the Combo Box can use.
      • This can be done using the choices function.
    2. Add Entity Type:
      • Add a field to the collection that indicates the entity type (e.g., "Account" or "Contact").
    3. Conditional Patch:
      • Use an If() statement in your Patch() function to conditionally set the @odata.bind property based on the selected entity type.
     
    Example of using the choices function.
     
    Code snippet (Example)
    ClearCollect(
        CombinedCustomers,
        ForAll(
            Accounts,
            {
                CustomerId: accountid,
                CustomerName: accountname,
                CustomerType: "accounts"
            }
        ),
        ForAll(
            Contacts,
            {
                CustomerId: contactid,
                CustomerName: fullname,
                CustomerType: "contacts"
            }
        )
    );

    Then your patch statement would look like this.
     
    Code snippet (Example)
    Patch(
        Caso, // or "Casi", the data source
        Defaults(Caso),
        {
            'Titolo caso': TitleTextInput.Text,
            'Priorità': PriorityComboBox.Selected.Value,
            // ... other fields ...
            'customerid_account@odata.bind': If(ComboBox1.Selected.CustomerType = "accounts","/accounts(" & ComboBox1.Selected.CustomerId & ")", Blank()),
            'customerid_contact@odata.bind': If(ComboBox1.Selected.CustomerType = "contacts","/contacts(" & ComboBox1.Selected.CustomerId & ")", Blank())
        }
    );

     
    By making these adjustments, you should be able to successfully create Cases with the correct Customer reference.
     
    If my answer was helpful, please click Like, and if it solved your problem, please mark it as verified to help other community members find more.
    If you have further questions, please feel free to contact me.
     
    My response was crafted with AI assistance and tailored to provide detailed and actionable guidance for your Microsoft Dynamics 365 query.
     
    Best Regards,
    Daivat Vartak

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 365 | Integration, Dataverse, and general topics

#1
Siv Sagar Profile Picture

Siv Sagar 93 Super User 2025 Season 2

#2
#ManoVerse Profile Picture

#ManoVerse 76

#3
Martin Dráb Profile Picture

Martin Dráb 64 Most Valuable Professional

Last 30 days Overall leaderboard

Product updates

Dynamics 365 release plans