What is a finite state machine and why is it like CRM 2015 Custom State Model Transitions

A CRM Developer at work mentioned the term Finite State Machine and it was curious because I had never heard of this term.

The CRM developer mentioned it as something you would learn in your first year of computer science course.  So I thought I would investigate and the best way to learn something is to learn it enough to explain it to someone else.

So I will start will the description from Wikipedia Finite State Machine

A finite-state machine (FSM) or finite-state automaton (plural: automata), or simply a state machine, is a mathematical model of computation used to design bothcomputer programs and sequential logic circuits. It is conceived as an abstract machine that can be in one of a finite number of states. The machine is in only one state at a time; the state it is in at any given time is called the current state. It can change from one state to another when initiated by a triggering event or condition; this is called atransition. A particular FSM is defined by a list of its states, and the triggering condition for each transition.

Abstract ideas harder to grasp

I remember when I starting out as a Java Developer I found it difficult to understand abstract ideas, particularly Abstract classes and Interfaces.

I have also found abstract ideas are harder to explain to other developers, the main reason for this is because its harder to use scenarios to explain the idea because Abstract ideas can’t be compared to physical objects.  Reading the Abstract vs Concrete article on wikpedia, it describes the difficult comprehending abstract ideas

The type-token distinction identifies physical objects that are tokens of a particular type of thing. The “type” that it is a part of, is in itself an abstract object. The abstract-concrete distinction is often introduced and initially understood in terms of paradigmatic examples of objects of each kind:

Examples of abstract and concrete objects
Abstract Concrete
Tennis A tennis game
Redness The red coloring of an apple
Five Five cars
Justice A just action
Humanity (the property of being human) Humanity (the human race)


This article is also interesting on Abstract versus concrete thinking

This brief article discusses why student find abstract ideas hard to understand

Understanding a Finite State Machine

The original definition on Wikipedia I found a bit ambiguous, the key to understanding something is you should be able to take the key concepts and explain them to someone in your own words.

The wikipedia definition I can take these key points

  • It can have only one state from a finite amount number of states
  • The machine can only have one state at a time, this is called the current state
  • It can change from one state to another
  • When a state changes this is called a transition
  • A state change is triggered by an event/condition

Whilst looking for articles on finite state machine I also found this excellent article on i Programmer

Finite State Machines

This article grabbed my interest in the first paragraph
Finite state machines may sound like a very dry and boring topic but they reveal a lot about the power of different types of computing machine.  Every Turing machine includes a finite state machine so there is a sense in which they come first. They also turn out to be very useful in practice.

I enjoyed reading this article and I started to understanding the logic of the finite state machine in more detail

  • The machine has an input which changes the state of the machine
  • The next stage depends on the current state and the input

Pictures are worth a thousand words on finite state machines

Below is a picture taken from Wikipedia here, the example is a finite state machine for parsing the word nice.  Notice if you price the correct letter sequence the state moves along.  You have the input of the character being typed in but it also checks the current state.


The example has

  • 4 states (Inactive, Active, Paused, and Exited)
  • 5 types of state transitions (Begin Command, End Command, Pause Command, Resume Command, Exit Command).
Here is a great example – Packman

Youtube Videos

State transition table

The other important concept of the finite state machine is the state transition table.  This is a table of all the possible states and the important concept is you have to include all the potential states and you cannot miss out any

The wiki article has a very simple state transition table for a

Current State Input Next State Output
Locked coin Unlocked Unlock turnstile so customer can push through
push Locked None
Unlocked coin Unlocked None
push Locked When customer has pushed through lock turnstile
Here is another example of a state transition table from here

here is a video

CRM 2013/CRM 2015 – Status Reason transitions/Custom State Model Transitions

When I was reading about finite state machine I was thinking about CRM 2013/CRM 2015 and the new functionality

Status reason transitions

this is also known as Custom State Model Transitions

It helps to understand the finite state machine to see how status reason transitions might work and how useful they can be.  The status reason transition doesn’t work exactly like the finite state machine but it’s in the same ball park

Before CRM 2013 you could change from any status reason to another status reason.

e.g. an incident could go from Open to Closed and completely missing out in progress.

With Status being able to move to any status this usually meant the status had to be programmatically moved and not allowed the user to directly change the status.


The status reasons would be removed and added using Javascript.

With Status reason transition functionality you can set what status reasons you can move to from your current status reason.

e.g. the user can only move to closed status from the status In-Progress.

Here are some good articles on status reason functionality

Define status reason transitions

Define status reason transitions for incident (case) management

Custom State Model Transitions

The custom state model transitions offer a great way to control status transitions without having to write lots of code and customizations

After reading about finite state machine it’s easy to see how you can use custom state model transitions to create this functionality and importantly it helps you think about the status for your entities and what available paths should be available to the user.

What I have learnt from learning about the finite state machine and the new state model transitions is when you are thinking about a Crm solution you should think about the entity statuses and the state transitions, what are the possible paths.

Its interesting to split up the design in

Current state
Next state

The more time you put into design of your CRM solution the better the code will be structured and less changes to design and code later on.

3 thoughts on “What is a finite state machine and why is it like CRM 2015 Custom State Model Transitions

  1. Raphael February 4, 2016 / 10:50 am

    Thanks a lot for the explanation and the bridge according to dynamics functions.
    I’m also wondering, if there might be a chance to link the statustransitions with securitymodels. So SecurityRole A could change Status 1 to 2, 2 to 3. And SecurityRole B only from 1 to 3 or 2 to 3. Do you have any suggestions or hints about this?


Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s