CRM 2013 – What is the WRPC Token and resolving INVALID_WRPC_TOKEN errors

Program testing can be used to show the presence of bugs, but never to show their absence!

 

I was tasked with load testing Microsoft Dynamics CRM 2013 and I quickly ran into some problems getting INVALID_WRPC_TOKEN error

Performance Testing

We tried to use Telerik for performance testing but this ended in failure because we couldn’t get the encoded guids from the responses.

So I am now trying Visual Studio Web Performance and Load tests, which you need Visual studio 2013 Ultimate or Visual studio 2015 Enterprise editions.

Visual studio – Web Performance and Load Test Project

token error 0

I won’t go into performance testing in this post but focus on the pesky token error.  Please take into account when I do mention performance testing I might get things completely wrong, this is because I’m learning about it, using the tried and tested way of trying it and making lots of mistakes (feel free to correct me in the comments)

How did I get the error

When you do performance testing you go through this process

  1. you click start recording
  2. this brings up an Internet Explorer browser
  3. Run through the process you want to test
  4. Stop recording

This captures all the HTTP traffic (looks like a fiddler trace).  If you haven’t used Fiddler I would recommend these two links to get started

When I ran the test of my recording I got an INVALID_WRPC_TOKEN error

token error

Which leads me to the question, what is an WRPC token?

What is a WRPC token

The first place to start the search should be the CRM SDK – Why CRM Developers should always start with the CRM SDK

It took quite a lot of searching but I finally got to this page

Key management in Microsoft Dynamics CRM

Microsoft Dynamics CRM uses two kinds of private encryption keys for deployments accessed over the Internet:

Web remote procedure call (WRPC) token key. This key is used to generate a security token, which helps make sure that the request originated from the user who made the request. This security token decreases the likelihood of certain attacks, such as a cross-site request forgery (one-click) attack.

 

The WRPC key’s purpose is to stop people using programs to send requests to CRM and trick it into return data.

The WRPC token is embedded into each request.  You maybe thinking once you work out the token you can use it every time time.

Back to the Microsoft page Key management in Microsoft Dynamics CRM for another quote

Key Regeneration and renewal

CRM ticket keys are automatically generated and renewed and then distributed, or deployed, to all computers running Microsoft Dynamics CRM or running a specific Microsoft Dynamics CRM Server 2013 role. These keys are regenerated periodically and, in turn, replace the previous keys. By default, key regeneration occurs every 24 hours.

 

I have bolded the key part, key regeneration occurs every 24 hours.  This is great for stopping bad people making naughty requests but it’s not so good for my load testing script which has the WRPC token embedded into it’s recording.

Other WRPC Token errors

Whilst I was searching for information about the WRPC token I found a few more errors I have listed below

An old CRM 4 error by the awesome David Jennaway, who sadly never writes about CRM on his blog any more, he used to be an awesome source of CRM developer information.  The first link is a discussion about it.

INVALID_WRPC_TOKEN: Validate WRPC Token: WRPCTokenState=Invalid, TOKEN_EXPIRY=4320, IGNORE_TOKEN=False, MS CRM 2011

It seems you can get a token error if you open CRM in two different browsers!

Access denied error on closing of Appointment in CRM 2011

The blog was getting an error when they changed to HTTPS binding.

INVALID_WRPC_TOKEN at associating records thru CRM 2011 UI

Unexpected error while bulk edit

Work around for token errors

The only workaround I have found with regards to WRPC token is to disable the token being used.

I found the answer on this blog page

You can add a registry key which will disable the CRM token check.

On the CRM Server, open REGEDIT

Go to

HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\MSCRM

Create a DWORD registry key with the name IgnoreTokenCheck

Set the value to 1

Restart IIS or Recycle App pool

 

As with a lot of workaround this does mean your CRM is more open to cross site scripting attacks.

I wouldn’t recommend this for a production environment, unless it’s only a short term fix.

Back to my Web performance testing

I disable the check and my recordings were working without error.

Talking about Performance testing, Microsoft have released the CRM Peformance Toolkit for CRM 2015 but which is compatible with CRM 2013 (for free)

CRM-Performance-Toolkit for CRM 2013/CRM2015 is released

The tests will test all default entities and will provide a good starting point for creating your own tests.

Hopefully these tests will provide a way to get the WRPC token and save it as a parameter because turning off the WRPC token will only work for on premise CRM organisation because you cannot turn off this setting for CRM Online (you don’t have access to the server).

Hopefully with a bit of digging around I can work out how Microsoft have got round this WRPC token problem I was experiencing.

 

 

Advertisement

Hosk’s Top CRM Articles of the week – 28th September

I have been de-cluttering my stuff the last week, unsurprisingly I have too much stuff, which makes it difficult to tidy it all the way.

This book is amazing, it has changed me from a messy person to a tidy person who now folds his pants and socks! because as the author says “folding is fun”

The Life-Changing Magic of Tidying: A simple, effective way to banish clutter forever

The two key points which have changed the way I view tidying.  You are not deciding what to throw out but what to keep.  If an object doesn’t give you joy then get rid of it.

“Keep only those things that speak to your heart. Then take the plunge and discard all the rest. By doing this, you can reset your life and embark on a new lifestyle.”
― Marie Kondo, The Life-Changing Magic of Tidying Up: The Japanese Art of Decluttering and Organizing

 

The other key concept is once you have decluttered, everything has it’s place.  All of your items should have a distinct place and you put an item back in it’s designated place.

Buy the book, it’s awesome and if you click the link from this page I will get 5 pence or some huge amount :-).  I will be buying some for Christmas presents

Quote of the week

Knowledge alone is static. Know-how is knowledge in motion – Gold rule of software engineering

Joshua Levy

Article the week

Understanding the Microsoft Dynamics CRM Performance Center

Microsoft have added an awesome tool to show you the performance of your CRM forms but then it seems to get hardly mentioned.

The Cobalt blog is the best explanation of how it works I have read.

The most important bit which I keep forgetting, how to get the form up

Hit Control+Shift+Q to open the Performance Center window

Dynamics CRM performance troubleshooting

Good blog with lots of tips on finding performance issues

 Best of the Rest

CRM Web API Preview – Generate Strongly Typed Objects from Metadata Document

Great blog post on using the new Web API preview to create strongly typed objects and I personally loved strongly typed objects

What happens when you publish a duplication rule

have you ever wondered, me neither but someone has.

Online proctored Microsoft certification exams are now available

You can do your CRM exams in your pants in the comfort of your own home, beware they will use your laptop webcam to check your are not cheating.

CRM 2015 – Advanced find to return all enabled users with a security role

A Hosk blog talking about advanced finds

A list of CRM blogs you should be following

A small list of great CRM blogs you should be following

What’s new in CRM 2016 and why you should read the preview guide

Hosk’s looks at the CRM 2016 preview

Getting Cortana to Work on Australian Windows Phones

It’s good to see people putting Cortana to work

Microsoft Dynamics CRM 2013 White Papers & Technical Documentation

A great list of all the CRM 2013 white papers

CRM 2011 – How to set up a lookup using Javascript

How to set a lookup using JavaScript

Storing the “Last Activity” on a Microsoft Dynamics CRM record

Good blog to show you how to store the last activity, who needs machine learning

CRM 2011 shortcuts

CRM has lots of shortcuts, who knew

CRM Plugins – Stopping infinite loops and understanding PluginExecutionContext.Depth

How to stop infinite loops in your plugins, it’s all about the depth

How to get the server time in Dynamics CRM?

You never know when you need to get the server time, it’s like hammer time but better

Great list of CRM version numbers, Release Dates, Build Numbers, and Collateral 

It’s hard to remember build numbers, so luckily someone has collated them all in one list for you

how to Manage Microsoft Dynamics CRM Online updates

A great article from Microsoft about managing updates, you can turn them off to have one a year.

CRM 2015 – Why filtered views are useful

Filtered views are more awesome than you know

New Forms Authentication in ADFS 3.0 and IFD for Dynamics CRM

ADFS 3!

Lookup Field vs Option Sets in Dynamics CRM

Which is better, when should you use a lookup field?

MobileCRM: A different mindset in projects

great article on how to approach mobile CRM projects

Entity Image updater tool

It’s a tool to update entity image

Programming

he Golden Rule of Software Engineering

code reviews

other

Sleep May Be One of Our Most Powerful ‘Antibiotics’

Tires, coffee and people

Tim Ferris Morning Rituals podcast

How Do Excellent Performers Differ from the Average?

a dozen things I’ve learned from charlie munger about mistakes

tips on Writing Funny by Scott Adams

Keeping Things Simple and Tuning out Folly

Solitude and Leadership

What Two Teenagers Learned From Watching Every Best Picture Oscar Winner

Previous top picks

Hosk’s Top CRM Articles of the week – 21st September

Useful Hosk Links

Hosk list Of CRM 2013 Tools

A list and review of CRM 2013 tools, this will probably work in CRM 2015 as well

Hosk’s CRM Developer Articles

A collection of my favourite CRM Developer articles I have written

MB2-703 – CRM 2013 Customization and Configuration Certification Information

All the CRM 2013 content to help you pass the exam

HoskWisdom – Hosk Developer Quotes

 Words of Wisdom from the Hosk.  I have written over 900 articles, surely I should have said a few memorable things

What’s new in CRM 2016 and why you should read the preview guide

We keep moving forward, opening new doors, and doing new things, because we’re curious and curiosity keeps leading us down new paths.

Walt Disney

 

I go on holiday to Butlins for a week and Microsoft release a new version of CRM, well not actually release but an outline of what’s coming in CRM 2016 and the CRM community is vibrating with blogs, articles and general excitement of a new release.

There is a difference between theoretical knowledge and practical knowledge (a concept I talked about in this blog Why CRM Developers should always start with the CRM SDK), in a similar way there is a difference between functionality in the CRM 2016 preview guide and the functionality included in CRM 2016.

Working with Microsoft Dynamics CRM we must keep our eyes on the horizon scanning for new versions of CRM getting read to land

What is CRM 2016 preview

The preview document gives you a guide to the new features likely to be included in CRM 2016 but the features and functionality described in the preview document can be

  • Amended
  • Removed
  • New features added
  • Deprioritized

At this late stage it’s unlikely the functionality will change much but be aware functionality can change

New releases of Microsoft Dynamics CRM are exciting

  • There is always a new look and feel to CRM
  • Great new functionality for Sales men (like dashboards etc)
  • Useful new functionality for Developers
  • A bunch of Gotcha’s and limitations

The preview guide gives us a glimpse of the future, a road sign to help us anticipate the impact CRM 2016 will make.

The features might change but at least we have an idea of the new functionality and importantly what technologies or products are going to be used to deliver the new functionality.

Why you should read the CRM 2016 preview guide

The Scouts motto is be prepared, the handbook describes this in more detail

  • Be Prepared in Mind by having disciplined yourself to be obedient to every order, and also by having thought out beforehand any accident or situation that might occur, so that you know the right thing to do at the right moment, and are willing to do it.

The Scout’s had some good values because it’s not the first time I have used their advice.

Why you should write code and customizations like a boy scout

Being prepared allows you to survive but knowing the future functionality in CRM 2016 allows you to use this as an opportunity to take advantage by aligning your technical skills to the technology used to deliver the new functionality.

If you know what’s coming, you can position yourself to take advantage of it

Reading the preview guide you can see what functionality is coming, allowing you to prepare your skills and knowledge, enabling you to position yourself to start utilizing the new functionality.

Sometimes CRM developers can feel like Microsoft are constantly adding new features and not giving developers/consultants/solution architects time to get used to new functionality.

The reasons for reading the CRM preview guide are the same reasons CRM developers should read the What’s new for developers in the CRM SDK.

  • Knowledge
  • Start to prepare
  • Analyse the suitability of customizations for existing CRM projects
  • be prepared (Scouts motto)

There are some additional reasons you should  the CRM 2016 release notes

  • It’s not very long
  • you get an idea of what’s coming
  • a chance to see if anything exciting is coming
  • You can start to prepare
  • it’s decent CRM network conversation
  • Adjust your learning to focus on technology used in CRM 2016 (mobile, Azure Machine Learning, etc)

CRM Online customers

One aspect of CRM Online I found concerning from a CRM developers perspective is the process of updating the CRM version.  When ever a patch, service update or new CRM version is released the CRM customizations could stop working and you need to test ALL the customizations.

Testing all the customizations for complex projects can be take a lot of resources (people) and organising, so it’s important you are in control of this process.

Microsoft addressed this by allowing users to turn off the automatic updates but I’m not sure what happens for a new release or if you can turn off the updates indefinitely?

This technet article discussing managing CRM online updates (you have to approve the update)

Manage Microsoft Dynamics CRM Online updates

The document states updates are mandatory but you can have only one update per year

this update becomes mandatory and the customer will be required to take the update during the available dates for that particular release.

 

The thought of a CRM instance having to update to a new version causes my CRM developer heart beat to start racing.  Imagine if this happened to all the Microsoft Dynamic CRM projects I have worked on, this is another great reason for CRM developers not to write unsupported code

On the positive side this should make plenty of work for CRM developers, whilst they check their customizations work in the new release of CRM 2016.

CRM is constantly evolving

I view new release of Microsoft Dynamics CRM with excitement and In trepidation

It’s a wonderful world. You can’t go backwards. You’re always moving forward. It’s the wonderful part about life. And that’s terrific.

Harvey Fierstein

 

 

A CRM Developers life and CRM surroundings are constantly changing with major new releases coming once a year (new release or service pack update I classify as major release)

It’s exciting and sometimes tiring trying to keep up with change inside Microsoft Dynamics CRM.

CRM developers have new functionality to learn and master, CRM developers are constantly challenged.

CRM developers/CRM professionals need to work hard to keep up with the latest releases and functionality but with this difficultly comes opportunity.

With every new release of Microsoft Dynamics CRM you have the opportunity to become an expert in the new functionality, the go to person.

A key skill of the CRM developer is knowing what customization to use for a particularly customer requirement.  Microsoft Dynamics CRM is extremely versatile and required functionality can be achieved using different customizations but there is usually one type of customization which is ideally suited.

CRM developers know the different  versions of the CRM SDK and always start by referring to it

Key Information for the CRM 2016 Preview

The key information about the CRM 2016 preview can be found below

Release Guide link

Microsoft Dynamics CRM 2016 release guide

Microsoft Blog links

Microsoft reinvents productivity with upcoming release of customer engagement solution

Bob Stutz blog post

Microsoft Dynamics CRM 2016 – Delivering the Next Generation of Intelligent Customer Engagement

Release Date

Microsoft Dynamics CRM 2016 — in Q4 of this calendar year.  I find it amusing Microsoft can release CRM 2016 in the year 2015!

Microsoft Video Link

Microsoft Dynamics CRM 2016 Release Overview

Grand Quotes

I thought I would put some of the quotes, I love the idea of releasing quotes like this when I have created some code for a bugfix, maybe something like

“With this bug fix I have designed the code from the ground up to deliver the core functionality in one bug fix, which eliminates distractions and should dramatically increase customer productivity.  I have made field read only.”

Over exciting quotes from Bob Stutz and Microsoft

“We are eliminating the distractions people inevitably encounter when they bounce from application to application in the course of doing their job by taking away the need to export or switch applications, and by automating fundamental tasks.”

 

“Dynamics CRM 2016 is designed from the ground up to deliver core capabilities all in a single system to eliminate distractions, to make it easier to get things done, and to dramatically increase productivity so our customers can spend more time serving their customers.”

 

One quote from Microsoft press release

“The most comprehensive upgrade ever for Dynamics CRM includes advancements in intelligence, mobility and service, with significant productivity enhancements to help businesses and workers achieve more”

 

The direction of CRM 2016

Before looking at the functionality I want to highlight the broad direction of Microsoft Dynamics.

Microsoft have a clear hierarchy in platforms 

Cloud first, mobile second, on premise last

Microsoft’s policy of updating CRM on premise versions 6 months later definitely seems Microsoft’s way of gently persuading everyone to use the CRM online version.  I have talked about this before

What are the limitations of Microsoft Dynamics CRM Online and how do you work with them?

This seems a strange tactic because there are lots of reasons (data, complexity) why some CRM solutions are better suited to CRM On Premise.  Microsoft recently announced their Cloud certification to allow CRM on premise solutions to move to private cloud/Azure platform, which I blogged about here.

I’m don’t understand why Microsoft are making their current CRM on premise customer wait six months when you consider these are likely to be larger deployments.  I don’t understand the 6 month delay at all, it’s confusing to customer, developers, everyone and isn’t going to persuade anyone to move from On Premise to CRM online????

Machine Learning

Machine learning sounds really interesting and using customers data to make recommendations and suggestions would be awesome.

Social CRM

Social CRM is moving from listening to interacting and integrating with the customers CRM data.

Integration

Microsoft are continuing to slowly to properly integrate their companies and products they purchased.  Parature integration is looking to bring in the powerful knowledge base functionality into CRM (whilst also Microsoft are creating their own knowledge base functionality!!!).

I find the slow rate of integration a bit puzzling, Microsoft purchased Parature ages ago.

CRM 2016 Hosk Notes

Here are my thoughts on the CRM 2016 preview guide, this is a developers eye view.

Below are my brief notes on the CRM 2016 preview guide

Productivity

  • CRM App for Outlook
  • Excel templates
  • Delve

Microsoft as a company seem to be focusing on improving productivity of office workers.  This involves integrating Microsoft’s differences products\services and the increased use of machine intelligence.

Intelligence

  • Cortana Analytics suite and machine learning
  • Intelligence product suggestions
  • recommend cases
  • Machine Learning

Personally I’m not interested in Cortana, I don’t want to talk to my computer or CRM but Microsoft keeps working at it, integrating into more applications so I am probably going to need to get used to it.

The machine intelligence is one area I find really interesting.  I view it as CRM using the customers data to help, recommend similar cases or knowledge articles for the case your are working on.  Intelligent product suggestion based on your selected choices.

I imagine it working in a similar way to Amazon using your viewing history and purchasing history to recommend other products.  If Microsoft can add this type of functionality into CRM then it would be fantastic.

I currently have no idea how Azure Machine learning works and my mind boggles at how you would set it up??

Mobility

  • Offline capabilities
  • Task based mobile apps
  • Cortana

The mobile app is slowly getting better but my question to Microsoft is why is it taking so long?  This is almost 3 years of development on the mobile app now.  Progress is being made, offline capabilities for mobile apps are always good and Task based might make it more useful in some circumstances.

Unified Service

  • Field Service (a company/product Microsoft purchased last year)
  • Parature knowledge management (meant to be very good)
  • Native Knowledge management

Integration between the purchased products continues slowly

Marketing

  • SMS Marketing – {shudder}, I don’t think I have ever received a welcome SMS message.
  • Email – view Generated HTML

HTML emails are great, SMS marketing is a bad concept (no one likes receiving text messages, its like a pop up for phones)

Interesting stuff from a CRM developers perspective

  • Bulk Data Loader for CRM online
  • a new cloud service to bulk import/export data in Dynamics CRM online.
  • support for reoccuring data import/export
  • Modern Web API – OData v4

There isn’t a great deal for developers to get excited about but the developer tweaks are not usually mentioned in the preview guide (they look at high level functionality and new features).

The new OData v4 will be awesome

The bulk loader sounds interesting because a lot of projects use Scribe to insert data and this could potentially avoid that cost.  The bulk loader can also doing regularly/reoccurring imports and exports

Excel

  • Excel templates
  • Excel What if analysis

Excel is good because most people are comfortable with it, it’s easy to use and people can open it up and try it.  Most companies have an excel license so it doesn’t cost.

The new templates will work by opening an excel document and merging it with a template, which means it should be quick

Document generation – pre defined templates

  • A merge between an instant document and templates.
  • Document templates are role based
  • Work for Word and Excel.

This sound like a great idea.

External Party Access

An API to allow third parties (customers, partners) to access CRM data.  You model the access inside CRM.

Wow, sharing CRM data for third parties.  The question I have is how would the licensing work for this?  How will this fit in the current 2000 different licences you can currently use.

Mobile

  • Can view IFrames!
  • Disable copy and paste to stop data leakage
  • Enforce Encrpytion
  • offline

Some good features added here

Social CRM

  • Interact with customers
  • Publish tweets and facebook posts

The move from Social listening to social interaction makes the social CRM functionality really start to work.

Social  CRM is or will be a key area in customer support and the ability to respond to social media events in cases will become increasingly important.

I will be interested to see how the preview differs from what is actually implemented.

Quote from the preview guide

In addition to Twitter, Facebook, Blogs (WordPress/Tumblr), Videos (YouTube) and News, you will now be able to search boards/forums and custom sources via RSS. This includes internal non-public sources, like Yammer

Guided User Experience

This will probably be very useful to new users but I can already imagine it’s going to be really annoying to experienced users as CRM keeps popping up with advice and guidance (go away you damn paperclip)

Azure Machine Learning

  • Product Cross Sell recommendations
  • Suggested Knowledge based articles

Further reading

don’t forget CRM 2015 rollup

Just because everyone is talking about CRM 2016, don’t forget there has been a patch for CRM 2015

Get Ready for update CRM 2015 1.1

 

CRM 2015 – Advanced find to return all enabled users with a security role

I had a requirement to find all the users who had a security role because I needed to update a value.

Advanced find is easy to find

I am a big fan of the advanced find and have been known to have many open at the same time

Why the advanced find is a CRM Developers best friend

In CRM 2013 Microsoft made it difficult to find the Advanced (Why Microsoft why?).  I often had to think how to find the advanced find which is a big no no in UX design (Good CRM design should not make users think)

The bad treatment of the advanced find caused one CRM developer to create a solution which added the advanced find to every record

CRM 2013 Tool – Advanced Find on record forms for CRM 2013

Security Priviledges

If you have users who don’t have security roles you will see this (annoying) message

Advanced find users with security roles 1

The common reason for the message above is due to users being added and not yet given any security roles, which is usually because someone forget or they are being lazy

Other reasons for users having no security roles is moving users between business units.  When you move a user between business units it removes all the security roles.

Sometimes CRM admins can take away user roles from a user rather than disabling them.  The user won’t be able to do anything.   Remember a users security privileges can come from Team membership, not only their individual security roles.

If you want to learn more about users and security roles, read this brilliant article from CRM MVP Adam Vero

Security Roles and Teams in CRM – An Inconvenient Half-Truth

For a brief overview of security roles and business units

Business Units and Security Roles

a list of limitations and rules of CRM security read my exam notes

 

Creating the Advanced find

This advanced find was straight forward, I wanted to search the User entity for users who had security roles.

I selected user record, adding a condition to the security role where it contain data.

Advanced find users with security roles

Advanced find limitations

You cannot do Not in queries with advanced find.  If the requirement was to find all the users who didn’t have any security roles, this would have been impossible to do in advanced find.

Hopefully the Not query functionality will be added to Microsoft Dynamics CRM and the good news is there is a connect item we can vote up (it has over 600 votes)

Allow NOT IN searches in advanced find, marketing lists etc

The bad news is it has been an issue since 2011.  I have noticed a growing number of issues raised in connect, going through the channels Microsoft recommends and the issues not being fixed.

In the blog post Is Microsoft Listening to the Dynamics CRM Community? I suggest Microsoft should revamp the connect system and process so they can utilize the feedback generated by the CRM community to improve Microsoft Dynamics CRM.  At the moment I feel the Connect website and process is to slow and isn’t working.

If you need the functionality now I have seen two customizations you can try using

Building “Not In” Queries Using Dynamics CRM Advanced Find

Performing Outer Join in Advanced Find

 

 

 

 

Hosk’s Top CRM Articles of the week – 21st September

Lets start with a quote

To forgive is to set a prisoner free and discover that the prisoner was you.

I have got two articles of the week this week (it’s a fluid system) and neither of them are really articles.

Article(s) of the week

CRM Developer Extensions v1.2.0.0

The alternative to CRM Developer toolkit created by Jasson Lattimer CRM Developer Extensions is improving rapidly.  If you wondering why this is important then read where is the CRM developer toolkit for CRM 2015 and CRM Developer toolkit alternatives.

CRM Developer extensions has added some great new functionality

  • 1 click deploy plug-ins and custom workflow assemblies from Visual Studio
  • 1 click deploy reports from Visual Studio without having to go through CRM
  • Added CRM TypeScript template
  • Web Resource deployer

Importantly this works with CRM 2015 and it’s free

Podcast of the week

CRM Podcast TypeScript and JavaScript with David Berry

When ever I read or hear Dave Berry talk about CRM or TypeScript I learn something new and this podcast is full of interesting views and opinions.  It’s quite a long podcast about an hour long

Below we have some more Dave information and Links

Dave Berry MVP Q&A

Dave also did a great Q&A, easily the funniest one

Dave has a great article on Typescript and CRM
Introduction to TypeScript for (Xrm) Developers

What is TypeScript and how does it work with CRM 2011/2013

This article is the one I wrote, it’s more an introduction to typescript and where to find some more information

Best of the rest

Why the advanced find is a CRM Developers best friend

The Advanced is awesome, find out why

Why CRM Developers should always start with the CRM SDK

Always start with the CRM SDK, it will help you learn new features and functionality.

Undocumented Useful Script Functions in Dynamics CRM

Microsoft has a bunch of inbuilt script functions used by Microsoft Javascript code.  You can use those functions in your own code, you do need to be aware this is unsupported and Microsoft could change the Javascript at any moment

Just because everyone is talking about CRM 2016 don’t forget CRM 2015 Patch

There is a new CRM 2015 patch

Understanding levels of abstraction can improve your code design

Improve you code design and consider the levels of abstraction in your code

How to free storage space in Microsoft Dynamics CRM

Some great tips on reducing storage space on CRM online instances

Are your CRM plugins creating technical debt?

Is the way you write plugins causing technical debt in your CRM solutions?

5 Ways To Improve Microsoft Dynamics CRM Performance

Some tips to improve performance

Should you hire a Rockstar developer for your CRM project?

Do you want to put all your CRM development eggs in one basket?

Why you shouldn’t put unsupported customizations in Microsoft Dynamics CRM

Some reasons why you shouldn’t write unsupported customizations

Great Tool – OrgDBOrgSettings tool for Microsoft Dynamics CRM

Useful tool to tweak the CRM DB settings

CRM 2015 – How to Diagnose plugin errors

How to diagnose plugins errors, tips and good practices.

White Paper – Microsoft Dynamics CRM 2015 Performance and Scalability Documentation

Fantastic white paper on performance and scalability.

CRM and SQL Tip #01 – How to find out the Security Roles assigned to the user

SQL query to find security roles assigned to a user

13 signs your project is doomed

Signs you CRM project could be about to hit trouble.

Programming

Why Other Tech Talent Gets Paid More Than You by Lane Campbell 

The Myth of the Rockstar Programmer

good developers vs bad developers

Other

A Dozen Things I’ve Learned from Charlie Munger about Inversion (including the Importance of being Consistently Not Stupid)

4 easy ways to communicate more clearly in writing

I have 75k saved up in my bank account. I’m 24 years old. I want to generate passive income and retire by 30. What should I do with the money or how should I invest it?

Book Lovers Alert: 8 Of The Most Spectacular Libraries In The World

How netflix reinvented HR

Netflix slideshow on HR

Good introductory article on machine learning

28 ideas to become 5 times more productive

Elon Musk’s First Wife On What It Takes To Become A Billionaire.

Disney’s $4 Billion Steal

Previous top picks

Hosk’s Top CRM Articles of the week – 1st September

Useful Hosk Links

Hosk list Of CRM 2013 Tools

A list and review of CRM 2013 tools, this will probably work in CRM 2015 as well

Hosk’s CRM Developer Articles

A collection of my favourite CRM Developer articles I have written

MB2-703 – CRM 2013 Customization and Configuration Certification Information

All the CRM 2013 content to help you pass the exam

HoskWisdom – Hosk Developer Quotes

 Words of Wisdom from the Hosk.  I have written over 900 articles, surely I should have said a few memorable things

Understanding levels of abstraction can improve your code design

The right level of abstraction in coding helps your code become easier to read/understand and bringing consistency and a logical design to your code.  When you see the right level of abstraction used it intuitively seems right.

Getting the correct level of abstraction is creating a consistent level of design in your code.

Understanding Abstraction

Understanding Abstractions in code design is difficult and takes repeated attempts at learning the concepts.  It’s worth persevering with because abstractions play a key role in code design and two important concepts of good code design

  • Encapsulate what varies
  • Code to an interface not a concrete class

To get started with abstraction in code design and understand the benefits read my blog post below

Why understanding abstractions can help you write better code

The right level of Abstraction

There are many articles/books which mention the concept of getting the level of abstraction right in your when designing code but not many of them explain the concept clearly.

To know if you understand something you should be able to explain it someone (or yourself) in simple terms don’t understand it well enough.

Albert Einstein

I found the concept of the right level of abstraction difficult to understand until I read a great section on exceptions in Code Complete 2.  The chapter described defensive programming and exception handling.  Below I will go through a similar example found in the book.

When you choose to pass an exception to the caller, make sure the exception’s level of abstraction is consistent with the routine interface’s abstraction

If I had a class called car with a method to return the engine size


Class Car{

Public GetEngineSize() throws ArrayTypeMismatchException

}

Calculating the engine size if all the correct fields aren’t set the code throws an ArrayTypeMismatchException, so the code throws this error.

Now ask yourself the question, is this exception the right level of abstraction?

The calling code doesn’t need to know the detailed error about arrays or type conversion errors.  Instead the calling code is more interested in data is not available.

The right level of abstraction would be improved with this error

Public GetEngineSize() throws CarDataNotAvailable

The calling function level of abstraction is concerned about the Car data, the original error message was at a lower level of detail.  The lower level of detail is the correct error to the concrete car class which implements the code logic, it’s useful to know what type of exception is thrown because it might deal with different errors in different ways.

The interface is a higher level, Engine, wheels, colour.  Classes using the interface are only interested in problems with the data, not the actual error which caused the problem.

The benefits of getting the right level of abstraction are

  • The code feels right
  • The design of the code is logical and easy to understand
  • Consistency

Why should I care about the level of abstraction

Setting the right level of abstraction is one small part of the process of improving the design of your code to make it easier to maintain in the future.

Finding the right level of abstraction for your code is often done after the initial code has been written.

Creative writers have to edit their first draft, advice to writers is to give themselves permission to write a bad first draft.

Writing code is similar because the first draft of code is focused on getting the code working, delivering the required functionality.  Designing good code is an emerging process, which I discuss in this blog post

Unit tests are a vital part of emerging code design

Developers should refactor their code after the initial draft.  The initial draft usually gets the code to work (short term goal) further iterations should improve the code by

  • simplify the code
  • reduce complexity
  • Improve readability
  • Improve the naming of classes, methods and variables
  • reduce coupling by creating new classes and methods
  • Setting the right level of abstraction and putting code in the right place

Another similarity with writers emerges because hopefully we are removing unnecessary lines (and methods).  In coding terms fewer lines of code means fewer lines of code to maintain, debug and read.

The refactoring and improving the design of the code is a stage often missed out by many developers.  The code will still work the same so many developers don’t see the value of refactoring and improving the design of the code.

The code working as required is the initial requirement

Refactoring and improving the design fore fills the long term requirements of maintaining code once written, such as

  • Reading/understanding the code
  • Resusing code
  • Easier to debug
  • Easier to extend
  • Reduces the effects of change on the code

If you miss out the refactoring stage you will soon end up creating legacy code and technical debt.  Read the articles below for more information

Conclusion

Good development is as often making lots of small good choices and avoiding making mistakes. Each complex method/class you avoid writing should be replaced with something simple.  Putting code in the right place and getting the level of abstraction correct is one of many small good design choices.

If you add put together lots of good code design choices you will end up with good code.

Why CRM Developers should always start with the CRM SDK

The CRM SDK is the main tool for a CRM developer, the better a CRM developer knows its capabilities, limitations and documentation the more efficiently they can do their job.

CRM developers should always start with the CRM SDK, it contains all the functionality needed to work with CRM, yet many developers rarely look in the CRM SDK documentation for clarification/help usually turn to the internet to search for examples and code.  Retrieving code examples results in a missed opportunity to learn about the CRM SDK.

What is the CRM SDK?

There is the actual CRM SDK, which you download Microsoft Dynamics CRM Software Development Kit (SDK) for CRM Online and on-premises CRM 2015 This gives you a bunch folders and files with sample code and the all important CRM dll’s and maybe a link to the CRM developer toolkit as long as you haven’t downloaded CRM 2015 (Where is the CRM Developer toolkit for CRM 2015?)

CRM SDK download

When I mention the CRM SDK, I am talking about primarily about documentation which describes the functionality contained in CRM dll’s.  In the download it’s the CrmSdk2015.chm, I use the online documentation because it’s easier to search.

Software Development Kit for Microsoft Dynamics CRM The CRM SDK documentation is awesome but I distinctly remember finding it difficult to use when I was learning CRM development.

I talk more about the CRM SDK in this blog post and it’s a good place to start learning about it

This is my CRM SDK

In the film Full Metal Jacket Gunnery Sergeant Hartman tells the recruits to give their rifles a name because it’s their best friend and could save their life (he actually says give the rifles a ladies name because they won’t be getting their hands on any ladies for a long time).

CRM developers should view the CRM SDK as their development rifle.  It’s your best friend and your main tool in CRM development and it will save you development life on numerous occasions with the it’s functionality and features.

Gunnery Sergeant Hartman: Pray!
Recruits: [chanting] This is my rifle. There are many others like it, but this one is mine. My rifle is my best friend. It is my life. I must master it as I must master my life. Without me, my rifle is useless. Without my rifle, I am useless. I must fire my rifle true. I must shoot straighter than my enemy, who is trying to kill me. I must shoot him before he shoots me. I will. Before God I swear this creed: my rifle and myself are defenders of my country, we are the masters of our enemy, we are the saviors of my life. So be it, until there is no enemy, but peace. Amen.

Most CRM developers aren’t allowed guns at work because in times of frustration it would be too tempting to shoot their computer but each CRM developer will have his own copy of the CRM SDK (for each version of CRM).  I have adapted the quote to make it more suitable for CRM development

CRM developers: [chanting]

This is my CRM SDK. There are many others like it, but this one is mine. My CRM SDK is my best friend. It is my life. I must master it as I must master my life. Without me, my CRM SDK is useless. Without my CRM SDK , I am useless.   I must development with my CRM SDK true.  I will.

Before Hosk I swear this creed: my CRM SDK and myself are defenders of my CRM Solution, we are the masters of the CRM Solution, we are the saviours the CRM Solution. So be it, until there is are no bugs, but peace in CRM dev land. Amen.

CRM Development is like a jigsaw puzzle

I view CRM development as a jigsaw puzzle, like a jigsaw puzzle CRM development contains many different but connected pieces.

Learning and understanding the different pieces often helps see how the other pieces of the jigsaw fit together.

A couple of examples could be

  • Learning about plugin architecture can help understand how workflows, real time workflows work and why plugins are quicker.
  • Understanding  SetSubmitMode in Javascript and how does it works can help you understand update plugins are only passed the values of fields which have changed, so in order to get other fields you need to add an image.

Learning new skills is a mix of theoretical (reading, videos, etc) and practical (doing).  There is a different between theoretical knowledge and practical knowledge, which occurs when you try to get the sample code to run and have to fix many  small problems before it works.  Whilst fixing these problems you learn how things really work.

Theoretical knowledge without practical experience has a limited value because until you write some code or create a customization you can’t be really sure you know how to do it.

Practical knowledge without theoretical knowledge is more useful but this can be a slow way to learn, involving making lots of mistakes and learning best practices through action.  Problems and errors can be harder to diagnose and fix if you lack the theoretical knowledge and understanding of how the CRM SDK works.

The above section is the long way of saying CRM developers should read the CRM SDK documentation.

CRM developers and the CRM SDK

The CRM SDK is the supported/safe way to interact with the Microsoft Dynamics CRM database.  Just like an annoying family member you are stuck with it and every day you come to work you are going to have to work with CRM SDK.

The CRM SDK can be stubborn, difficult and renowned for not suffering fools gladly

The CRM SDK is a cruel mistress to those who do not show it respect but if you play nicely, tickle CRM SDK’s belly it will deliver untold development riches

One of my common quotes  regarding CRM development is

Always start with the CRM SDK

You cannot work around the CRM SDK

My advice to CRM developers who are thinking about creating unsupported CRM customizations is don’t even think about it.

If you put unsupported CRM customizations into your CRM solution Microsoft will not support your CRM Solution.

Do you want to the person who has to inform the customer you cannot get support for a CRM problem (which could be a bug in Microsoft Dynamics CRM) because you wrote an unsupported CRM customization.

There are other reasons why you should put unsupported customizations in

  • Upgrading CRM will be harder
  • Unsupported customizations could stop working with any rollup or patch
  • Microsoft won’t support the CRM Solution

Read more reasons Why you shouldn’t put unsupported customizations in Microsoft Dynamics CRM

How some CRM developers work

Most developers when faced with a task they are not sure about will look for some sample code to use.  The common places to get some code are

  • Internet search
  • Hosk’s Dynamic CRM Blog
  • Existing code
  • Ask a question on the CRM forums
  • Ask a fellow developer how to do it
  • Look at the SDK

Most developers view development

  • Code
  • Debug
  • Test
  • Repeat

Learning through experience is a valid way to learn but it can be a slow way to learn, where the developer has to make all the mistakes themselves and remember to learn from them.  Reading the CRM SDK will help you understand how CRM customizations work and avoid some of the errors/mistakes.

The CRM SDK documentation contains the limitations of functionality, it’s vital to know the limitations of the functionality to avoid it causing problems when you find out later a certain piece of functionality can’t be used.

Examples

  • Plugins have a 2 minute time out, if you have some long running C# code then this needs to be done as a custom workflow.
  • Rollup fields cannot reference other rollup fields.
  • Business rules can’t reference values from other entities, JavaScript could be a better choice.
  • Workflows are Asynchronous, if you need the customization to run synchronously you need a real time workflow or a plugin.

Strive to understand how CRM SDK works

I encourage CRM developers to always start with the CRM SDK and to see what functionality is available and to increase your understanding of how the CRM SDK works.

Getting code examples is great but it bypasses the learning involved in creating the code yourself.

All craftsman should know their tools, a CRM developers main tool is the CRM SDK.  CRM developers should know the CRM SDK forwards, backwards, upwards, downwards and inside out.  A CRM Developer should know the CRM SDK better than members of his family

You can view the CRM SDK as a family member

  • It’s troublesome
  • Can be extremely annoying at times
  • CRM SDK can bring you great joy
  • You have no option (supported option) but to get on with it
  • It’s constantly changing and evolving
  • It can be difficult to understand what it’s saying (confusing error messages!)
  • You love it

Why should you learn how the CRM SDK works

The better you understand the CRM SDK and the CRM platform the more in depth your understanding will be of the different customizations available for CRM developers.

CRM SDK knowledge is extremely useful in finding and diagnosing bugs, particularly tricky/subtle bugs.  I have seen bugs which involved plugins, workflows and Javascript overwriting the same fields.  Understanding how the different CRM customizations work with regards to synchronously and asynchronously helped me diagnose the problem

Error messages don’t tell you the problem but often point you in the right direction.  If you have studied the CRM SDK this will make sense, if you haven’t error messages can be extremely confusing.

In my blog post CRM 2015 – How to diagnose plugin errors it details plugin errors and how CRM SDK knowledge helps when things go wrong

Why you should read the CRM SDK what’s new

The CRM SDK has detailed sections on the new functionality for CRM developers and what functionality has been depreciated.

This article explains why you should read the what’s new

CRM 2015 SDK – Why you should read the What’s new for developers

here is my blog on the new functionality in CRM 2015 SP1

What’s new in CRM 2015 SP1 for developers, customizers and admins

CRM MVP’s

In 2014 I managed to persuade/pester many of the CRM MVP’s to fill in a Q&A which you can read here

One common trait in CRM MVP’s is they have a detailed knowledge of CRM and the CRM SDK and this knowledge comes through in their in depth blog posts.

Continuous Learning

My aim each day is to know more about CRM development when I leave work than when I started it.

Hosk’s Top CRM Articles of the week – 14th September

I have been on holiday for a week at the awesome Butlins, I had a great time but boy was it tiring.

I saw Scooby Doo, Mike the Knight, Angelina the Ballerina and Katie from Cbeebies, went on rides, danced, playdoh, bubbles, saw a castle and went to the beach.

Here are my Mini Hosk’s having fun

IMG_20150909_091319

Article of the week

editable grid in CRM? here are the choices

Sometimes customers will want an editable grid, this blog posts goes through some of the options.

best of the rest

Overcoming Multi-Level Rollup Field Limitation

Codeless solutions can sometimes be tricky.  This blog posts gets round the rollup field limitation of you can’t reference a rollup field in a rollup field.  Codeless solutions sometimes can involve using code other people have written in a free solution!

Set Address using Lookup Address for locked Address fields in Dynamics CRM

Setsubmit and dirty fields can cause headaches for CRM developers because CRM only updates fields which are dirty (dirty means changed).  This blog post above shows how they got round the problem.

I would also suggest reading my blog post

CRM 2011/2013 – What does setSubmitMode do? and how does it work?

creating a Codeless Opportunity Payment Schedule in CRM

A codeless solution from the king of the no code solutions Leon Tribe.

CRM 2015 – how to find Statecode value

How to find the statecode value for an entity

Microsoft Dynamics CRM Browser Compatibility

Browser compatiablity is a problem which can sneak up on CRM upgrades, makes sure you know what internet browsers you can use.

Dynamics CRM Outlook Synchronization: How it Works – white paper

Outlook synchronization is great when it works and terrible when there is a problem.  Read this white paper to learn what’s going on under the hood

CRM 2013 – How add a status reason using the CRM SDK

You can use the CRM SDK to create status reasons and set the int number used

solution simple questions

This blog answers some of the common questions about solutions. I also recommend reading Hosk blog posts

Modifying Click-To-Call Hyperlink Properties for CRM 2013 Phone Fields

Setting click to call hyperlinks on some system fields, involves a bit of tinkering.

CRM 2013 – Plugins – Simple update plugin – Redeploying, improving and updating

Step by step guide to updating a plugin

Lock/Unlock Composite fields using Java Script in Dynamics CRM

Expanding Field Label Widths in CRM 2015

Expanding field labels is not straight forward (like many things in CRM), find out how

How to Avoid Code Complexity?

Great post on how to avoid code complexity, something I am always trying to avoid.

On a similar subject read my two blog posts on the subject

Programming

Code Review – The Ultimate Guide

About Clean Code

Code Watch: The first four habits of highly employable developers

Other

Roughly 100 Fantastic Pieces of Journalism

How Germany abolished tuition fees

critical thinking

3 words to revolutionize the world

Get it Done: 35 Habits of the Most Productive People (Infographic)

The AI Revolution: The Road to Superintelligence

The Ten Most Important Books To Expand Your Brain

Simplify Your Life

Previous top picks

Hosk’s Top CRM Articles of the week – 24th August

Useful Hosk Links

Hosk list Of CRM 2013 Tools

A list and review of CRM 2013 tools, this will probably work in CRM 2015 as well

Hosk’s CRM Developer Articles

A collection of my favourite CRM Developer articles I have written

MB2-703 – CRM 2013 Customization and Configuration Certification Information

All the CRM 2013 content to help you pass the exam

HoskWisdom – Hosk Developer Quotes

 Words of Wisdom from the Hosk.  I have written over 900 articles, surely I should have said a few memorable things

Hosk’s Top CRM Articles of the week – 1st September

Article of the week

Announcing CRM DevTools for CRM 2015 and Update 1!

This brilliant tool for Chrome has been updated.  Not only is this a great tool but even if you don’t use the tool it points out lots of functionality built into CRM which can allow you to debug and investigate CRM.

The tool is free.  Three cheers for Sonoma Partners

Microsoft Cloud Certification could allow complex CRM solutions to go online

I’m putting my blog post here this week because I want to know readers opinions on the new Cloud Certification Microsoft has just starting offering.  Moving On Premise CRM to a private cloud with one click!

best of the rest

CRM 2015 – Why is the System user shown as disabled in the plugin registration tool

System user is show with disabled in brackets, find out why

How to build an Agile Inspired Project Management XRM Solution in less than a day with Microsoft Dynamics CRM

A great example of how you can quickly create a solution using Microsoft Dynamics CRM

Tip #457: Get your icons here

Get yourself some free icons for your custom entities

CRM 2015/CRM2013 – JavaScript to get the current users name

Javascript to get the current users name

You Too Can Snoop… But Not In A Creepy Way

Fantastic solution to allow you to get information on your plugins

Dynamics CRM 2015 – Top 5 Developers Delights

The inogic’s top five posts on new features for CRM Developers in CRM 2015 update 1

Tip #459: Don’t touch that file. Or that one. Or this one.

If you have edited the CRM web.config beware you may have trouble in the future

Standard and Enhanced SLAs in Microsoft Dynamics CRM 2015: How To Maximize Your Usage

Some help to understand CRM SLA’s

Why the advanced find is a CRM Developers best friend

The CRM advanced find is awesome, find out why

Cloud Certification now available for Microsoft Dynamics CRM

Cloud certification available

understanding plugin sandbox mode

Understand Plugins in sandbox mode

Explaining the built-in SYSTEM and INTEGRATION users

There are two special and hidden system users in CRM, find out more

CRM 2015 – CRM developers should think in Entities

Think in Entities CRM Developers

What Makes A Good CRM Consultant?

What are the qualities of a good CRM consultant

Come Clean With Your CRM Data

Clean your data

A Day in the Life of a CRM Admin

Q&A with a CRM Admin

Programming

How to be the Fastest Developer on Your Team, Part 1

Great article on 40-year-old lessons and the Mythical Man-Month

The mythical Man month is free to download, awesome

a quick summary of the The mythical Man month

Other

Do we need Windows 10?

Rich People like to read

10 Things Productive People Do Before Bed

Intel Inside… literally?

Brains Sweep Themselves Clean Of Toxins During Sleep

Why do some people refer to themselves in the third person? 

Previous top picks

Hosk’s Top CRM Articles of the week – 24th August

Useful Hosk Links

Hosk list Of CRM 2013 Tools

A list and review of CRM 2013 tools, this will probably work in CRM 2015 as well

Hosk’s CRM Developer Articles

A collection of my favourite CRM Developer articles I have written

MB2-703 – CRM 2013 Customization and Configuration Certification Information

All the CRM 2013 content to help you pass the exam

HoskWisdom – Hosk Developer Quotes

 Words of Wisdom from the Hosk.  I have written over 900 articles, surely I should have said a few memorable things