Skip to main content

Notifications

Announcements

No record found.

Service | Customer Service, Contact Center, Fie...
Suggested answer

Get Azure SQL data in Virtual entity

(0) ShareShare
ReportReport
Posted on by 75

Hello Experts,

I am working on Virtual entity and i am retrieving data from Azure SQL database for that I have written OData which retrieves Sql data from Azure SQL Database. I am trying to mapping data to virtual entity fields but data is not showing.

OutPut of ODataservice:

URL:  http://sqldb.azurewebsites.net/$metadata

"<EntityType Name="Contact">
<Key>
<PropertyRef Name="id"/>
</Key>
<Property Name="id" Type="Edm.String" Nullable="false"/>
<Property Name="Name" Type="Edm.String"/>
<Property Name="Phone" Type="Edm.String"/>
<Property Name="Email" Type="Edm.String"/>
<Property Name="Address" Type="Edm.String"/>
</EntityType>
</Schema>
<Schema xmlns="schemas.microsoft.com/.../edm" Namespace="AzureSqlDatabaseProject">
<EntityContainer Name="DefaultContainer" m:IsDefaultEntityContainer="true">
<EntitySet Name="Contacts" EntityType="AzureSqlDatabaseProject.Models.Contact"/>
</EntityContainer>"
{
  "odata.metadata":"http://sqldb.azurewebsites.net/$metadata#Contacts","value":[
    {
      "id":"1","Name":"abc1","Phone":"1111111111","Email":"abs@gmail.com","Address":"India"
    },{
      "id":"2","Name":"abc2","Phone":"2222222222","Email":"afgs@gmail.com","Address":"India"
    },{
      "id":"3","Name":"abc3","Phone":"3333333333","Email":"adfr@gmail.com","Address":"India"
    },{
      "id":"4","Name":"abc4","Phone":"4444444444","Email":"sdy@gmail.com","Address":"India"
    },{
      "id":"5","Name":"abc5","Phone":"5555555555","Email":"xyz@gmail.com","Address":"India"
    }
  ]
}
I have created record in Virtual Entity Data Sources,
pastedimage1581411818365v3.png
and I mapped the properties on fields for all fields
pastedimage1581411921369v4.png

But I am enable to get data, I am getting below type of error,

pastedimage1581412006018v5.png

How to resolve that issue?

From References:

1. https://docs.microsoft.com/en-us/dynamics365/customerengagement/on-premises/customize/virtual-entity-walkthrough-using-odata-provider

2. https://docs.microsoft.com/en-us/dynamics365/customerengagement/on-premises/customize/create-edit-virtual-entities

  • winston he Profile Picture
    winston he 220 on at
    RE: Get Azure SQL data in Virtual entity

    There could be something wrong when  the virtual entity is configured, you can raise a support team for Microsoft support team for  further deeper investigation. 

  • Kiran_girase Profile Picture
    Kiran_girase 75 on at
    RE: Get Azure SQL data in Virtual entity

    Thanks for reply winston he,

    I have added contactId as a guid and mapped on Primary Key but I am getting same error

    URL: dynamisitysqldb.azurewebsites.net/$metadata

    URL: dynamisitysqldb.azurewebsites.net/Contacts

    for Virtual Entity Data Sources

    URL: dynamisitysqldb.azurewebsites.net/Contacts

    TimeOut: 120

    Pagination Mode: Server-side Paging

    Return Inline Count: False

    I tried all the possibilities into the url and pagination mode but getting same error,

    pastedimage1581574775308v1.png

  • Suggested answer
    winston he Profile Picture
    winston he 220 on at
    RE: Get Azure SQL data in Virtual entity

    The reason is because there is no property of GUID type for your entity. To create a virtual entity and map it to CRM entity, there must be a GUID property. You can try this OData demo service and it will be fine:

    NOTE:contactId will be GUID field which is necessary.

    winstonodata4.azurewebsites.net/$metadata

    ...

    "

    </Key>

    <Property Name="contactId" Type="Edm.Guid" Nullable="false"/>

    <Property Name="name" Type="Edm.String"/>

    <Property Name="address" Type="Edm.String"/>

    <Property Name="email" Type="Edm.String"/>

    "

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 Verified Answers

Best practices for providing successful forum answers ✍️

Leaderboard

#1
André Arnaud de Calavon Profile Picture

André Arnaud de Cal... 291,431 Super User 2024 Season 2

#2
Martin Dráb Profile Picture

Martin Dráb 230,503 Most Valuable Professional

#3
nmaenpaa Profile Picture

nmaenpaa 101,156

Leaderboard

Featured topics

Product updates

Dynamics 365 release plans