Skip to main content

Notifications

Announcements

No record found.

Dynamics 365 general forum

How to get the DataType of any field in Dynamics 365 Web Api

Posted on by 25

Currently we are upgrading SDK references to Web Api (version 8.2) On-Premise. In SDK we can directly check the datatype of the attribute like below c# code. How do i check it in Web Api ?. Do we have any property to identify the type of an attribute ?

if (entity[attributeName] is Money)
{
if ((entity[attributeName] as Money).Value == targetValue)
{
isEqual = true;
}
}
else if (entity[attributeName] is DateTime)
{
if (Convert.ToDateTime(entity[attributeName]).Date == Convert.ToDateTime(targetValue).Date && Convert.ToDateTime(targetValue) != DateTime.MinValue)
{
isEqual = true;
}
}

Thanks,

Praveen 

  • PraveenCRM365 Profile Picture
    PraveenCRM365 25 on at
    RE: How to get the DataType of any field in Dynamics 365 Web Api

    Thanks Andrew!

    We are following "Dynamics 365 Web API" development style. We have already upgraded everything to Web Api since most of our external resources are API's. Coming to my query, For temporary workaround I'm getting the Attribute Type using Metadata request like below,

    /api/data/v8.2/EntityDefinitions(LogicalName='account')/Attributes(LogicalName='creditlimit')

  • a33ik Profile Picture
    a33ik 84,323 Most Valuable Professional on at
    RE: How to get the DataType of any field in Dynamics 365 Web Api

    Praveen,

    Check following post please - docs.microsoft.com/.../jj602917(v%3dcrm.8)

    I believe you develop .Net app so XrmTooling + SDK assemblies is a best and recommended by Microsoft solution.

  • PraveenCRM365 Profile Picture
    PraveenCRM365 25 on at
    RE: How to get the DataType of any field in Dynamics 365 Web Api

    Hi,

    I am accessing the CRM data in External application (API Controller). Since Microsoft is going to deprecate the organization data service in future release we are upgrading everything to Web Api (not SDK/Proxy service anymore).

  • a33ik Profile Picture
    a33ik 84,323 Most Valuable Professional on at
    RE: How to get the DataType of any field in Dynamics 365 Web Api

    Hello,

    I'm curious - why do you update references to WebApi? You still can use SDK assemblies where you can check type of fields.

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

November Spotlight Star - Khushbu Rajvi

Congratulations to a top community star!

Forum Structure Changes Coming on 11/8!

In our never-ending quest to help the Dynamics 365 Community members get answers faster …

Dynamics 365 Community Platform update – Oct 28

Welcome to the next edition of the Community Platform Update. This is a status …

Leaderboard

#1
André Arnaud de Calavon Profile Picture

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

#2
Martin Dráb Profile Picture

Martin Dráb 230,188 Most Valuable Professional

#3
nmaenpaa Profile Picture

nmaenpaa 101,156

Leaderboard

Featured topics

Product updates

Dynamics 365 release plans