Posts in: May, 2018

Saving data with the Dynamics Web Api

In my previous posts on using the Dynamics Web Api, I invested a significant amount of time in figuring out the connection protocols, querying and accessing data from the results (not being an Azure, Active Directory or JSON expert).

However, when it came to saving data, the hard work was over and I was able to do with relative ease.

To save data via the Dynamics Web API, the interface is quite similar to how you would access your controls via LateBinding except that instead of the Entity object you are consuming a JObject.

JObject phoneCall = new JObject();
 phoneCall["subject"] = "Here comes my call";
 phoneCall["phonenumber"] = "888-999-7777";
 phoneCall["scheduledend"] = DateTime.Now;
 phoneCall["description"] = "Who called me.";
//The Direction Code is always an incoming call.
 phoneCall["directioncode"] = false;

string recordId = string.Empty;
 try
 {
 HttpClient httpClient =															

Read More


Retrieving Data with the Dynamics Web API

So after I worked that whole plural entity name thing on getting data from Dynamics, I now had my data coming back to me in a wonderful Json format.  When interacting with data from the Web API you query for information via the rest interface of your URL. (more on MSDN).

As an example, if I wanted to retrieve some information on a custom entity I could do it using this query syntax.

HttpResponseMessage response = await httpClient.GetAsync(dyanmicsTenant + "/api/data/v8.1/enc_medias?$select=dat_name,_dat_customer_value,dat_dataid&$filter=dat_name eq '" + SearchParameter + "'");

Which would return a Json package in the format of

{
"@odata.context":"https://myCrmTenant.crm.dynamics.com/api/data/v8.1/$metadata#datas(dat_dataid,dat_name)","value":[
{
"@odata.etag":"W/\"874140\"","dat_dataid":"fd95bfa1-ddb8-e711-8114-c4346bdcf161","_dat_customer_value":"{00665E23-779E-4C8C-A5D4-36213C41EA27}","dat_name":"0000000006"
}
]
}

A few things…

What is _dat_customer_value?

In my query, I wanted to get the lookup for a customerid, the field itself is called data_customerid, however, when accessing lookups you must prepend “_” to the field and append “_value” to the

Read More


Getting Started with the Dynamics Web API

The Dynamics Web API is the new “preferred” method for interacting with Dynamics entities from web-based applications.  If you are writing plugins and coded workflow activities, you would still use the pre-existing Dynamics SDK.

Getting familiar with the Web API is a bit of a leap of knowledge as you will dabble in Azure Authentication, JSON and Async implementations (if you’re not familiar with it).

Even though the API has been around since 2016, it’s disheartening to see there not being a singular location for Dynamics developers to bridge their current knowledge of the Dynamics SDK to the Web API.

Lots of trial and error still exists and this isn’t helped by the naming of the API either.

Also note, if you are hoping to get away with the now “vintage” Dynamics SDK, in

Read More


Accessing the Dynamics SDK in v9

If you are moving your work from an old Dynamics instance to v9, there are a few SDK to know about before you get started.

First – there is no SDK to download anymore.

Well, there is, but you do it through Nuget (and it’s great).

To install the core SDK framework – use the following Nuget command.

Install-Package Microsoft.CrmSdk.CoreAssemblies -Version 9.0.0.7

This will install all the core assemblies you need (i.e., not things like workflow assemblies).

To get the workflows you would need to execute the following Nuget command;

Install-Package Microsoft.CrmSdk.Workflow -Version 9.0.0.7

Different from the last few versions of Dynamics where you could get away with re-using SDK tools between different versions, with v9, you now need to download the updated set of tools via Powershell and use them from there.

Before downloading the

Read More