NoLock – to be set or not

NoLock – to be set or not

NoLock – what is that? NoLock is a QueryExpression property used to specify how a RetrieveMultiple request will behave. Take a look at MS documentation since I’m not used to rewrite someone else’s posts, CRM upgrade features and MS limited documentation. Long story short: NoLock property sets to TRUE looks at database record lock and waits […]

RollupField is not recalculating

RollupField is not recalculating

RollupField is not recalculating RollupField – yes, nice CRM >= 2015 feature. Theoretically a cure for all previous “manual” calculations. Of course it has some limitations but this post is not about that. MSDN documentation contains these informations anyway. Unfortunatelly I came across a major issue related with rollup field when it’s type is Money. When? […]

Linq LoadProperty method limits records for retrieving relations N:N – 5000

Linq LoadProperty method limits records for retrieving relations N:N – 5000

Linq LoadProperty Issue – Description Recently I had to fix some legacy code (one of the worst code I have ever seen) and improve requests performance. When reviewing the code everything looks fine. There was a OrganizationServiceContext generated by crmsvcutil. Because one of the property was N:N relation a LINQ LoadProperty method was used. Nevertheless business logic […]

ErrorSerializingRegFile – Plugin or Workflow Deployment Error

ErrorSerializingRegFile – Plugin or Workflow Deployment Error

ErrorSerializingRegFile  – when I first met with this one If you have found this post I assume that you have already looked for *.registerfile errors, plugin and workflow mismatches between register file and already registered items, deployment administrator security rights. ErrorSerializingRegFile – what that can mean? Everything during plugin deployment looks right, but is it? So […]

Count total number of records – how to??

Count total number of records – how to??

Count total number of records – what is the issue How simple can that be to count total number of records – just use linq query using EntitySet object like the one below var contactCounter = new ServiceContext(_service).ContactSet.Select(item => item).Count(); and that’s it. But no – you will get an exception: Invalid ‘count’ condition. An entity member is […]

Get attribute value audit, history

Get attribute value audit, history

What for Sometimes, there is necessity of getting historical values for entity attribute. Of course to do so audit for organization, entity and attribute have to be turned on. Code below allows user, with proper privileges, to read attribute value audit. For sure if you need fancy validation this code is no good for that. […]

Reset CRMAppPool with all services

Reset CRMAppPool with all services

Sometimes there is need to perform “deep” reset of entire IIS envirionment. To do so You can use powershell script: $CRMSnapin = 'Microsoft.CRM.PowerShell'; if ( (Get-PSSnapin -Name $CRMSnapin -ErrorAction SilentlyContinue) -eq $null ) { Add-PSSnapin $CRMSnapin } #iisreset # Recycle only CRM Application Pool to free dlls. C:\Windows\System32\inetsrv\appcmd recycle apppool /apppool.name:CRMAppPool C:\Windows\System32\inetsrv\appcmd recycle apppool /apppool.name:CrmDeploymentServiceAppPool […]

How to run code with elevated priviledge?

How to run code with elevated priviledge?

Sometimes code must be invoked with admin-user priviledge, e.g. when retrieving data to which invoking user has no access. In this scenario You can impersonate OrganizationService to other user only for time operation is executing. Invoking code which must be run with higher priviledged is extremely easy. Code is written just like it is in […]

Secure and Unsecure Configuration

Secure and Unsecure Configuration

Where it is used? When creating plugin in VisualStudio via DeveloperToolkit there is an option to provide some configuration. Configuration is a string field which can be represented witch simple string, XML, CSV or other schema.   Auto generated constructor is also created where both configurations are represented as plain string, which you can parse […]

Javascript SOAP or REST ?

Javascript SOAP or REST ?

  While writing javascript code it is the most fundamental question. Both ways are capable of CRUD operations, so what is the difference? Recently I’ve written some code to retrieve only one flag from opportunity entity at JS. Beside that JS entity had registered plugin at PreRetrieve.  Of course in plugin code I was checking if […]