Microsoft Dynamics CRM Web Services - Microsoft Dynamics CRM

What is Microsoft Dynamics CRM Web Services?

Microsoft Dynamics CRM presents critical web services that are used to access CRM from an outside application and invoke web techniques to carry out common business information operations including create, delete, update, and locate in CRM.

consider the following scenarios −

  • you have an outside .net software, which needs to talk to CRM. for example, you may need to insert a contact file in CRM when a new customer is registered in your external application.
  • Or maybe, you need to search information in CRM and show the search results to your external application.

In such scenarios, you may use the web services exposed through CRM to consume them for your application and carry out create, delete, replace, and locate operations in CRM.

I DiscoveryService Web Service

This web service returns a list of agencies that the required user belongs to and the URL endpoint for each of the organization.

IOrganizationService Web Service

This web carrier is the primary web service used for getting access to information and metadata in CRM. The IOrganizationService uses two critical assemblies –Microsoft.Xrm.Sdk.dll and Microsoft.Crm.Sdk.Proxy.dll. those assemblies may be observed inside the CRM SDK package inside the Bin folder.

Microsoft.Xrm.Sdk.dll

This assembly defines the core xRM techniques and types, which includes proxy classes to make the connection to Microsoft Dynamics CRM simpler, authentication techniques, and the provider contracts.

Microsoft.Crm.Sdk.Proxy.dll

This assembly defines the requests and responses for non-core messages in addition to enumerations required for working with the organization information. Following are the namespaces supported by these two assemblies.

Each of these assemblies assist certain messages, so as to be used to work with the information saved in any entity. A complete list of messages supported through them may be found in the following links −

Supported xRM Messages − https://msdn.microsoft.com/en-us/library/gg334698.aspx

Supported CRM Messages − https://msdn.microsoft.com/en-us/library/gg309482.aspx

IOrganizationService Web Service Methods

The IOrganizationService presents eight techniques that lets in you to carry out all of the common operations on the system and custom entities as well as organization metadata.

S.No

Method Name & Description

1

IOrganizationService.Create

Creates a record.

2

IOrganizationService.Update

Updates an existing record.

3

IOrganizationService. Retrieve

Retrieves a record.

4

IOrganizationService. RetrieveMultiple

Retrieves a collection of records.

5

IOrganizationService. Delete

Deletes a record.

6

IOrganizationService. Associate

Creates a link between records.

7

IOrganizationService.Disassociate

Deletes a link between records.

8

IOrganizationService.Execute

Used for common record processing as well as specialized processing such as case resolution, duplicate detection, etc.

Web Service Example

To recognize how the web services work in CRM, we can observe an example provided through CRM SDK. In this example, we can create a new Account report, update it, and then finally delete it using the CRM IOrganizationService web service.

Step 1 − Open the folder in which you had extracted CRM SDK. Now open the QuickStartCS.sln solution through browsing to the following location:SDKSampleCodeCSQuickStart

Microsoft Dynamics CRM - Web Services

Step 2 − we can be exploring the QuickStart with Simplified Connection project. Open app.config in this project. by default, the connectionStrings section on this document may be commented.

Microsoft Dynamics CRM - Web Services

From this, uncomment the primary connection string key and edit the following 3 information −

Url − Specify the URL of your CRM example. In our case, because we are using the online version of CRM, you may have to mention that URL.

Username − Your CRM online user name.

Password − Your CRM online password.

Microsoft Dynamics CRM - Web Services

Step 3 − Open the SimplifiedConnection.cs file in this project and Runmethod inside it.

Step 4 − This technique basically demonstrates all of the CRUD operations using CRM web services. The code first creates an organization instance, then creates an Account record, updates the created document and then finally deletes it. let us observe the critical components of this code. to see on-the-go adjustments in CRM when this code runs, you can debug this code step-through-step (as we discuss below) and simultaneously see the adjustments in CRM.

Step 4.1 − Establishes the connection to the organization using the connection string that we had changed in Step 2.

Step 4.2 − Obtains a proxy instance of CRM organization web service.

Step 4.3 − Creates a new Account entity object and sets its name, AccountCategoryCode and CustomerTypeCode.

Step 4.4 − Creates the new record using the Create method of organization service.

If you navigate to CRM, you will see a newly created account record.

Microsoft Dynamics CRM - Web Services

Step 4.5 − once the account receives created, the provider retrieves back the record from CRM using Retrieve web service technique.

Step 4.6 − Once you have the retrieved record, you can set the updated value of the record.

Step 4.7 − After setting the updated fee of the report, update the document back to CRM database using the update web service technique.

If you open the record in CRM, you will see these values updated there.

Microsoft Dynamics CRM - Web Services

Step 4.8 − Finally, delete the record using the Delete web service method.

If you now refresh the same record in CRM, you may see that the document is no more available because it is already deleted.

Microsoft Dynamics CRM - Web Services

Conclusion

In this chapter, we treated two critical web services provided through CRM and a working example of the way these web services may be used from an outside utility to perform various CRUD operations.

All rights reserved © 2018 Wisdom IT Services India Pvt. Ltd DMCA.com Protection Status

Microsoft Dynamics CRM Topics