Use OData Query in ADXStudio

As we know Adxstudio Portal is now one of the most used Web Portal integrated with Dynamic CRM and one of the most common requirement and frequently asked question by developers is How to use retrieval query on Portal to fetch data from CRM.

One of the most common requirement on Portal is to auto populate data in entity forms fields based on lookup value.

For Example : As soon as user select customer in Customer lookup field, I want to auto populate selected customer entity data on case entity form fields (customer email, mobile phone, company name etc). Like this there might be so many requirement to fetch CRM data on portal conditionally.

Before going through the usage of OData in Adxstudio Portal first let us understand what is OData.

What is OData ?
OData is also referred as Open Data Protocol. Dynamic CRM mainly uses Windows Communication Foundation (WCF) data services framework to provide OData Endpoint which is nothing but a REST based data service. The address for the endpoint is:

https://{OrganizationRootUrl} /XRMServices/2011/OrganizationData.svc

How to use OData in Adxstudio Portal ?

I have been asked so many times for how to use OData Query in Adxstudio Portal,

Below are the steps to use OData query in adxstudio :-

Step 1 – Create Entity List in CRM with below mentioned configuration.

Name of Entity List, Entity Name, Website, View, OData Feed – Enabled,Entity Type Name, Entity Set Name, View





Step 2 –  Test OData.


Hit your portal url  on browser in below mentioned format.

/_odata   –  This will give you all Entity list in which you have enabled OData Feeds.

Hit your portal url  on browser in below mentioned format.

/_odata/   –  This will give you the result of OData on browser.

Step 3 –  How to use OData in JavaScript (on Entity Form/Web Form/Entity List/Web Page/).

// Start Case Retrieval code

var GetResolvedCases = \”~/_odata/cases?$filter=statuscode/Value eq 1\”;

or

var caseGuid = \’A237C638-F47B-E611-80F2-5065F38BF2F1\’;

var retrievebyGUID = \”~/_odata/incidents?$filter=incidentid%20eq%20(guid%27\” + caseGuid + \”%27)\”;

$.ajax({
    type: \”GET\”,
    url: GetResolvedCases,
    dataType: \’json\’
}).done(function (json) {

    var CaseColl = json.value;

    // Get Case ticket number
    if (CaseColl[0].ticketnumber)
    {
        CaseId = CaseColl[0].ticketnumber;

    }
})
})

// Case Retrieval code End


Using above code you can get Case ticket number, if you are familiar with Dynamic CRM OData query then you can make query as per your requirement, or you can refer below link to know more about OData query syntax and uses.

Note : Refer below link for more details about how to write OData Query in CRM/Portal

https://msdn.microsoft.com/en-us/library/gg309461(v=crm.7).aspx

Advertisement

Published by arpitpowerguide

My name is Arpit Shrivastava, who is a Microsoft MVP in the Business Applications category. I am a Microsoft Dynamics 365 and Power Platform enthusiast person who is having a passion for researching and learning new things and acquiring immense knowledge. I am providing consistent help, support, and sharing my knowledge through various Social Media Channels along with my Personal Blog, Microsoft Community, conducting online training and attending various 365 Saturday Events worldwide and sharing the best Solutions to the readers helping them achieve their goals and objectives in Customer Relationship Space.

8 thoughts on “Use OData Query in ADXStudio

  1. Special thanks to (hackingsetting50@gmail.com) for exposing my cheating husband. Right with me i got a lot of evidences and proofs that shows that my husband is a fuck boy and as well a cheater ranging from his text messages, call logs, whats-app messages, deleted messages and many more, All thanks to (hackingsetting50@gmail.com), if not for him i will never know what has been going on for a long time. Contact him now and thank me later.

    Like

  2. Special thanks to (hackingsetting50@gmail.com) for exposing my cheating husband. Right with me i got a lot of evidences and proofs that shows that my husband is a fuck boy and as well a cheater ranging from his text messages, call logs, whats-app messages, deleted messages and many more, All thanks to (hackingsetting50@gmail.com), if not for him i will never know what has been going on for a long time. Contact him now and thank me later.

    Like

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s

%d bloggers like this: