Get isActivity from Metadata

This week I had to differentiate between normal entities and activities in Javascript. I had a look into the SDK and remembered my previous post “Get EntitySetName from Metadata“. A little modification and I get true or false from the ‘isActivity’ information in the metadata.

Here it is fo you: Get isActivity from Metadata



CalculateRollupField with WebApi function in Javascript

Microsoft added with Service Pack 1 a new function called “CalculateRollupField” in Dynamics CRM (v 8.1) which enables us to recalculate a rollup field on demand.
I will show you here how you can use it in Javascript with a http request against the WebApi.

The CalculateRollupField function inside the webrequest needs a few parameter to know which rollup field you want to to calulate:

  • The EntitySetName of the target record.
    I wrote here how you can get the EntitySetName from the Metadata with an webrequest too.
  • The GUID of the target record.
  • The schema name of the target field.

CalculateRollupField in Javascript:

The answer of the webservice for the CalculateRollupField function contains the value for the target field, the date of the last calculation and its state.

CalculateRollupField Result


CRM background color

With Dynamics CRM 2015 Update 1 Microsoft introduced the possibility to create own themes. In this post I won’t show you default settings and screenshots of unicorn colored CRM systems, I will show you the hidden setting for the CRM background color.

When you query the properties of a theme you will discover a setting that isn’t visible on the theme record (the highlighted line).
Please spare yourself the trail to customize the theme formular, it is not possible.

So I had the idea to update the value directly through a web service call and it works.
After publishing the theme, I had a new CRM background color.

CRM background color

What you need to know is that Microsoft changes value back to the original CRM background color (#FFFFFF), every time you save the record through th UI.

The CRM background color bookmarklet

Since I’m a lazy guy who likes it when things are reusable, I’ve created the following bookmarklet.

Drag and drop the “CRM background color” button on your bookmark toolbar.

With the bookmarklet your process to change the CRM background color is:

  1. Open your theme record
  2. Make your customizations
  3. Save the theme
  4. Use the bookmarklet
  5. Publish your theme

I’m not sure if Microsoft will support it.
From a technical point of view is it only an update of a record through the webservice. Considered a manufacturers point of view, they don’t want that we can change it – otherwise we had probably an option for it in the UI.

Happy styling!


Get EntitySetName from Metadata

Everybody who has worked with the Web Api, in the system formerly known as Dynamics CRM (honestly, I do not know how to call it now), must have notice that you can’t pass the EntityLogicalName to it. It expects the EntitySetName, which is a kind of plural name for the entity.
Not to be confused with the plural display name you can configure in the entity.

So far I had a little Javascript function that tried to imitade the rules wich are responsible for the generation of the EntitySetName. But since there can be some exceptions, I’m now the opinion that it would be more reliable to query the metadata directly from the system.

Here it is: Get EntitySetName from Metadata


Export a solution via Javascript

Last week I got an error during a solution export, but the error message wasn’t very helpfull. I then had the idea to export the solution via Javascript with the hope to get an more meanfull error.
Fortunately it was so and by the way I’ve learned how to export a solution via Javascript.


How to load Javascript from a webresource

Imagine an usecase where you can dynamically load a Javascript from the CRM webresources because it doesn’t need to be loaded on every single form load. Perhaps a polyfill to add missing browser functions or a Javascript library like jQuery. Here it is…

My personal usecase was to add a promises polyfill to the Internet Explorer. So, if you combine this post, my post about “Internet Explorer and promises” and you have a promises polyfill in your CRM webresources, you can use promises and do only load the polyfill in case the browser doesn’t support it.