Cive.DynamicsCRM.Extensions C# Nuget Package has been released

I have decided to gather some of the most used functionalities into a single Nuget Package when coding C# against Dynamics CRM.

The package allows users to connect to Dynamics CRM and execute fetchXML queries in an easy fashion. I will add more functionalities in the feature and keep the post updated.

https://www.nuget.org/packages/Cive.DynamicsCRM.Extensions/

Package Manager Command:

Install-Package Cive.DynamicsCRM.Extensions -Version 1.0.2

After getting the Nuget Package into your project add the following using statement.

using Cive.DynamicsCRM.Extensions;

Examples:

Connect to CRM instance and get IOrganizationService interface:

var service = CRMConnection.GetOrganizationService("crmorganizationurl", "username", "password");

Connect to CRM instance and get CRMServiceClient which also contains IOrganizationService and other useful information

var client= CRMConnection.GetServiceClient("crmorganizationurl", "username", "password");

After establishing connection and getting the service object, you can execute fetchXML methods.

Retrieving entities from CRM, following command can only retrieve up to 5000 records.

var records = CRMFetchXML.Retrieve(service, fetchXMLstring);

If you want to retrieve more than 5000 records, use the following code.

var records = CRMFetchXML.RetrieveMoreThan5000(service, fetchXMLstring, 1000);

The last arguments defines the batch number.

Leave a comment below if you have any questions or suggestions.

How to use Javascript at Developer Console on Dynamics CRM pages

Just open up any Dynamics CRM page or record and hit f12. Then, if there are more than one frames, select one of the frames that contains CustomScriptsFrame text in it.

customScriptsFrame

Then, you will be able to use XRM framework that Dynamics CRM exposes.

Xrm.Page.data.entity.getEntityReference();

It will return the entity reference of the record that you just opened.

Xrm.LookupObject {entityType: “lead”, id: “{E9975EA3-531C-E511-80D8-3863BB3CE2C8}”, name: “Allison Brown”}

CustomScriptsFrame is the frame that all Javascript or HTML codes run at.

See you in another topic.