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
Below are the steps to use OData query in adxstudio :-
Hit your portal url on browser in below mentioned format.
<Portal Url>/_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.
<Portal Url>/_odata/<Entity Set Name> - This will give you the result of OData on browser.
// 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
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, ViewStep 2 - Test OData.
<Portal Url>/_odata - This will give you all Entity list in which you have enabled OData Feeds.
<Portal Url>/_odata/<Entity Set Name> - 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
How to insert the data using Odata Call in CRM Portals/Adxstudio
ReplyDeleteHow to filter using the lookup text??
ReplyDeleteeg: ?$filter=oki_preferredlanguage/Name eq (Text'English')
Well I really liked reading it. This post provided by you is very constructive for proper planning.
ReplyDeletepython cloud development
ReplyDeleteDo you need Personal Loan?
Business Cash Loan?
Unsecured Loan
Fast and Simple Loan?
Quick Application Process?
Approvals within 24-72 Hours?
No Hidden Fees Loan?
Funding in less than 1 Week?
Get unsecured working capital?
Contact Us At : gaincreditloan1@gmail.com
Whatsapps +31-635-250-311 (WhatsApp Only)
I'm getting Object reference not set to an instance of an object.error has anyone experienced this ?
ReplyDeleteSpecial 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
ReplyDelete(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.