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 :
Dynamics 365 general forum

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

(0) ShareShare
ReportReport
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 

I have the same question (0)
  • a33ik Profile Picture
    84,331 Most Valuable Professional on at

    Hello,

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

  • PraveenCRM365 Profile Picture
    25 on at

    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
    84,331 Most Valuable Professional on at

    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
    25 on at

    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')

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 > Dynamics 365 general

Last 30 days Overall leaderboard

Featured topics

Product updates

Dynamics 365 release plans