Tip #381: These tools give the shell its power

Since CRM 2013, SDK team has been including XRM tooling components in a low key fashion. It was kind of there but kind of was not getting any attention. Over the time though these tools have been slowly growing a reputation as one of the central building blocks in the SDK. Not surprisingly though, when you consider the functionality and flexibility these tools possess. For example, it is notoriously difficult to get the thread safety right in the CRM client applications; at the same time XRM tools claim to provide:

… thread safety for actions performed in CRM in a multithreaded environment.

The flexibility of the toolset is noticeable when applied to PowerShell. Consider this script (to be run in \bin folder):

.\RegisterXRMTooling.ps1
Add-PSSnapin Microsoft.Xrm.Tooling.Connector
$conn = Get-CrmConnection –InteractiveMode

Connect to your favourite CRM and now we can check, uhmmm, dunno, the plural name for an entity?

$conn.GetEntityDisplayNamePlural("contact")

Or verify if sample data installed?

$conn.IsSampleDataInstalled()

(Just in case you were expecting true/false – return values are Completed/NotImported – go figure)

Easy to connect, easy to create/read/update/delete the data, easy to execute. Some messages are confusing (CloseIncident() vs. CloseTroubleTicket() o__O) but overall impression of the toolset is very good and we’ll be covering more of it in the future.

Note

If you receive the following error executing Get-CrmConnection –InteractiveMode:

Get-CrmConnection : Set property 'System.Windows.ResourceDictionary.Source' threw an exception.
At line:1 char:1
+ Get-CrmConnection -InteractiveMode
...

then simply download and install the latest CRM SDK – the issue has been fixed.

One thought on “Tip #381: These tools give the shell its power

Leave a Reply

Your email address will not be published. Required fields are marked *