serving the solutions day and night


Tuesday, September 10, 2013

Programming Models for MS Dynamics CRM 2011

Key programmability scenarios for MS Dynamics CRM 2011

Early-bound – MS Dynamics CRM 2011 uses an entity data model and Windows Communication Foundation (WCF) Data Services technologies to provide a new set of tools that interact with Microsoft Dynamics CRM. For example: an organization service context that tracks changes to objects and supports .NET Language-Integrated Query (LINQ) queries to retrieve data from MS Dynamics CRM. Early bound classes generated directly from the metadata, which include all customizations.
CrmSvcUtil.exe - CRM Dynamics 2011 Code Generation Tool

Late-bound – Write code that accesses entities that are not yet defined.

REST – The REST endpoint for AJAX and MS Silverlight clients provides an interface that you can use to work with MS Dynamics CRM data. Rather than directly invoking the SOAP-based web service, you can execute requests using a service that is based on a URI.
[Your Organization Root URL]/xrmservices/2011/organizationdata.svc
CRM Dynamics 2011 OData Query Designer

WSDL – Develop code from non-.NET clients, and does not depend on the use of MS Dynamics CRM assemblies. For example, Write code for MS Dynamics CRM in Java/PHP.

MS Dynamics CRM 2011 no longer uses the WSDL. Instead, reference two assemblies that allow to connect MS Dynamics CRM system for both early and late bound types.

Account entity = new Account();
entity["name"] = "My Account"; //loosely typed, late binding
entity.AccountNumber = "1234"; //strongly typed, early binding

Assemblies Included in the MS Dynamics CRM SDK

Assembly name Namespace name
Microsoft.Crm.Sdk.Proxy.dll Microsoft.Crm.Sdk Contains enumerations of possible picklists and integer values for some attributes.
Microsoft.Crm.Sdk.Messages Contains request and responses for business data model messages.
Defines the core xRM methods and types.
Microsoft.Xrm.Sdk Defines the data contracts for attribute types.
Microsoft.Xrm.Sdk.Client Defines classes for use by client-code, including a data context, proxy classes and the LINQ provider.
Microsoft.Xrm.Sdk.Discovery Defines classes required to communicate with the Discovery Service.
Microsoft.Xrm.Sdk.Messages Defines request/response classes for Create, Retrieve, Update, Delete, Associate , Disassociate, and the metadata classes.
Microsoft.Xrm.Sdk.Metadata Defines the data contracts for Microsoft Dynamics CRM metadata.
Microsoft.Xrm.Sdk.Query Defines query classes required to connect to Microsoft Dynamics CRM.
Defines types/methods required to author a custom workflow activity.
Defines methods/types for developing a custom email provider component
Defines types/methods for interacting with the Deployment Web Service.

Client-Side Programming Reference

GetGlobalContext function - It returns the same context object found in the Xrm.Page.context.
<script type="text/javascript" src="ClientGlobalContext.js.aspx"></script>
Methods (Xrm.Page.context also)  - getClientUrl, getOrgUniqueName, getServerUrl, getUserId, getUserRoles

Xrm.Page Reference - addOnSave, save (null | "saveandclose" |"saveandnew"), getIsDirty (any fields in the form has been modified), getEntityName
Xrm.Page.ui - close, getFormType (1 create, 2 update, 3 read only, 4 diabled, 6 bulk edit

Summary of Changes Between Versions - 4.0/2011

No comments: