Welcome to our website

Lorem ipsum dolor sit amet, consectetur adipisicing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua. Ut enim ad minim veniam, quis nostrud exercitation ullamco laboris nisi ut aliquip ex ea commodo consequat.

Duis aute irure dolor in reprehenderit in voluptate velit esse cillum dolore eu fugiat nulla pariatur. Excepteur sint occaecat cupidatat non proident, sunt in culpa qui officia deserunt mollit anim id est laborum. ed ut perspiciatis unde omnis iste.

Posts mit dem Label CRM 2011 JavaScript werden angezeigt. Alle Posts anzeigen
Posts mit dem Label CRM 2011 JavaScript werden angezeigt. Alle Posts anzeigen

Donnerstag, 7. Juni 2012

Important to know before going to the next Release of CRM 2011

Due to the planned Multi Browser Support of Dynamics CRM Release for the upcoming Release it can be nessesarry to update some Java Scripts.

You can start the work now and be prepared for the installation of the next Release of Dynamics CRM 2011.



For detailed information on the Java Changes , please review the official Microsoft Dynamics CRM blog post.

Samstag, 24. März 2012

Dynamics CRM 2011: oData and Jscript in CRM 2011

oData is also referred as Open Data Protocol. CRM 2011 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:

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

oData uses some data format for sending and receiving the data. Basically it uses the following two formats.

  1. ATOM: It is an Xml based format mainly used for the RSS feeds.
  2. JSON: JavaScript Object Notation is a text formats which makes very easy for the developers to understand the response what we get.

We would be using the JSON format in our example.

The main OData service:

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

Examples:
1) For retrieving any EntitySet(here GoalSet )
http://{OrganizationRootUrl} /XRMServices/2011/OrganizationData.svc/GoalSet

2) For retrieving limited attributes use $select query option
http://{OrganizationRootUrl}/XRMServices/2011/OrganizationData.svc/GoalSet ?$select=IsAmount,MetricId
This will retrieve collection of IsAmount and MetricId for all Goals.

3) For retrieving data filtered on some criteria use $filter query option
http://{OrganizationRootUrl}/XRMServices/2011/OrganizationData.svc/GoalSet ?$select=IsAmount,MetricId &$filter=GoalId eq guid'" + goalid + "'";
This will retrieve IsAmount and MetricId for the Goal whose GoalId matches with the value of given goalid.

4) For retrieving data from related entity use $expand query option
http://{OrganizationRootUrl}/XRMServices/2011/OrganizationData.svc/GoalSet ?$select=IsAmount,metric_goal/Name,metric_goal/OrganizationId&$expand=metric_goal&$filter=GoalId eq guid'" + goalid + "'";

Here ‘metric_goal’ is the relationship property which defines realtionship between Goal and GoalMetric.

This retrieves IsAmount from GoalSet .Name and Organizationid are fetched from the related GoalMetricSet.

Microsoft Dynamics CRM 2011 does not support querying a multi-level relationship property.Maximum 6 expansion are allowed .

Following is an example for implementing oData using javascript in CRM 2011 to retrieve the required fields from Goal and Goal Metric entities.


As viewed in the snapshot above, three libraries have been included . It is compulsory to include jquery1.4.1.min.js and json2.js for implementing JSON format with oData.Both the files are available in SDK\ samplecode\ js\ restendpoint\restjquerycontacteditor\restjquerycontacteditor \scripts.The third file Goal.js contains two functions as given below i.e. ‘GetIsAmount’ and ‘RetrieveReqCallBack’ which are used to retrieve values for different fields like IsAmount(from Goal entity), Name and OrganisationId(from GoalMetric entity).




function GetIsAmount() {
var goalid = Xrm.Page.data.entity.getId();
var oDataPath = Xrm.Page.context.getServerUrl() + "/xrmservices/2011/organizationdata.svc";
var retrieveReq = new XMLHttpRequest();
var Odata = oDataPath + "/GoalSet?$select=IsAmount,metric_goal/Name,metric_goal/OrganizationId&$expand=metric_goal&$filter=GoalId eq guid'" + goalid + "'";
retrieveReq.open("GET", Odata, false);
retrieveReq.setRequestHeader("Accept", "application/json");
retrieveReq.setRequestHeader("Content-Type", "application/json; charset=utf-8");
retrieveReq.onreadystatechange = function() { RetrieveReqCallBack(this); };
retrieveReq.send();
}

function RetrieveReqCallBack(retrieveReq) {
var metricId = null;
if (retrieveReq.readyState == 4 /* complete */) {
var retrieved = JSON.parse(retrieveReq.responseText).d;
var isAmount = retrieved.results[0].IsAmount;
var Name = retrieved.results[0].metric_goal.Name;
var OrganizationId = retrieved.results[0].metric_goal.OrganizationId;        
}
}

http://www.dynamicsconsulting.de/2012/03/24/dynamics-crm-2011-odata-and-jscript-in-crm-2011/

Twitter Delicious Facebook Digg Stumbleupon Favorites More

 
Design by Free WordPress Themes | Bloggerized by Lasantha - Premium Blogger Themes | Free Samples By Mail