Archive

Archive for the ‘Workflow’ Category

Using Formulae in Dialogs: Example Lead Scoring

February 7, 2011 Leave a comment

When using Microsoft Dynamics CRM have you ever wondered how to create and use formulae in Dialogs? Yes this is possible using two features supported in Dialog Processes: Variables and Assign Value step. If you look at the Dialog designer page, you will see a section for creating Variables as shown in figure below.

clip_image001

You can add Variables with default values using this step. The Variables can be later used to create formulae in your Dialog. Three types of Variables are supported by Dialog: Single Line of Text, Whole Numbers and Floating point Numbers. Once you click on Add you will get a Dialog for defining the variable as shown in below figure.

clip_image002

Once the Variable is defined it appears as below figure on the designer.

clip_image004[4]

You can Edit or Delete the Variables after it is defined. You can modify the name and default value of the Variables. However you cannot modify the data type of the Variables once defined. This limitation is to avoid data type mismatch errors. Suppose if some variable is defined as floating point number and used to create formulae in Dialog Process and later the variable’s data type is changed to Text then the steps using the Variables for multiplication or addition would become invalid.

Now once your Variables are defined, you can use them to create a formula using Assign Value step which is available in Add Step menu on designer.

clip_image006[4]

Once you click the menu option you will see Assign Value step on the designer where you can fill the name of this step. You can use Set Properties button to create the formula. The step looks like below figure on designer.

clip_image008[4]

Once you click the Set Properties button a formula definition Dialog will appear. The Variables defined in the Dialog will automatically appear in the Name dropdown.

clip_image009[4]

Assign Value step supports different kind of Operators for all data types supported. For example; following table illustrate the operators supported for different data types.

Data Type Operators
Single Line of Text Set to, Append with and Clear
Whole Number Set to, Increment by, Decrement by, Multiply by and Clear
Floating point Number Set to, Increment by, Decrement by, Multiply by and Clear

Let us now develop a Dialog for Lead Qualification. Suppose your company is running some marketing campaign through phone call. Assumption is that the phone call records already exist with Regarding field as Lead and Recipient also as Lead to whom call has to be made. The marketing executive is running Dialog to achieve the objective. For this we need to author a Dialog. We will create a Dialog for Phone Call entity so that while making an outbound call, the Marketing executive directly launch the Dialog from Phone call page and start the Dialog for conversing at phone with the probable Opportunity. In order to simplify the example we will assume that the customer will be asked 2-3 questions in order to qualify the lead as Opportunity or lost Lead. First we have to plan the Dialog. For simplicity, we have very limited set of questions to qualify the Lead as shown in below flowchart.

clip_image011

Step 1 of this flowchart can be implemented with Assign Value step where the name variable is Set To regarding Lead’s First name data slug which is illustrated in one of the above figures. The variable initialized with First Name can be used in a Prompt greeting customer as shown below.

clip_image012

Now you have to check if the customer is further interested in continuing the talk. If yes then we will increment the value of current_score by 5 as per flow chart shown above and continue with other steps as per flow chart in the if-then block. To increment the value of current_score by 5 we would do following.

First select the variable ‘current_score’ from name dropdown, ‘Operator’ as ‘Increment By’ , then type ’5.0’ in the ‘Default value’ text box and finally click Ok on the Form Assistant.

clip_image013

In case user is not interested then we would deduct the 10 points from the current score as shown below.

clip_image014

Now you get how to create formulae in your Dialog. The final Dialog will look something like shown in below figure.

clip_image016

In above Dialog, you will notice that you can change the status of Regarding(Lead) to Qualified however the Process (Dialog or Workflow both) does not provide option to convert this Lead to Opportunity or Account. That can be achieved by placing two Create Record steps, one to create Account with the Lead’s company’s name and other to create an Opportunity with the same topic as that of the Lead as shown in following figures.

clip_image018

Create Account step would be configured as shown in below figure and the same account can be used as potential customer for the Opportunity created due to Lead qualification.

clip_image019

Obviously the Created Opportunity should have same topic and customer created in previous steps which is simple as shown in next figure which you get on clicking Set Properties button of Create Record step.

clip_image020

Finally test the Dialog after activating it to verify that if the Lead is qualified the corresponding Account and Opportunity are created.

Cheers,

Ramesh Pandey

Advertisements

Introduction to Queues in Microsoft Dynamics CRM 2011

December 22, 2010 Leave a comment

The Last Workflow Extension I’ll Ever Need

November 3, 2010 Leave a comment

It’s been a while since I’ve posted anything juicy. But today’s idea is too good not to share it.

Let’s have a look at a typical function in a typical workflow extension inside a typical workflow assembly, say, Business Productivity Workflow Tools:

image

And here is the use:

image

Two numbers and a math operator which is a choice of +, –, *, / and a mighty Mod. How exciting. So if I want, I don’t know, log or exp or anything else, I’ll have to extend the source code, recompile, test and deploy.

Sigh

At this point the story’s got a bit more interesting. While I was exploring different ways to build weighted revenue for an opportunity using the calculator, Shilpa has beaten me to the punch with an excellent post on how to calculate it using just CRM 4.0 built-in features. Doh! Lesson: quite often the simplest solution in CRM is just around the corner.

Unfortunately, there is still a limit to what CRM can do out of the box. One of our customers is obsessed with calculating errors in their estimates, i.e. ((actual revenue – estimated revenue) / estimated revenue), as one of their sales army KPIs. Initially we’ve implemented this as part of the reporting but later added a new attribute and code to update its value as opportunities are won. The latter approach means that new field can be added to the views and used to filter and sort the records. Well, there is no built-in division and there is no Abs function in the original calculator so it turned out to be indeed a case of “extend the source code, recompile, test and deploy.

Meh

Instead, what we ended up with looks like this:

image

Inspired by the brilliant The Last Configuration Section Handler I’ll Ever Need, we’ve decided to generalise some of the workflow extension code and give workflow designers a simple scripting mechanism.

How did we do it? Every single .NET framework installation comes with a full C# and VB compilers. And, what’s more, code can be compiled dynamically.  So the “heart” of our code performing the actual calculation looks like the following:

   1: static decimal TwoDecimalCalculator(decimal d1, decimal d2, string whatToDo)
   2: {
   3:     string codeWrap = @"
   4:         namespace Georged
   5:         {{
   6:             public static class Compiled
   7:             {{
   8:                 public static decimal SomeInternalMagic(decimal d1, decimal d2)
   9:                 {{
  10:                     return ({0});
  11:                 }}
  12:             }}
  13:         }}";
  14:  
  15:     // insert user's string and compile code into an assembly
  16:     string code = string.Format(codeWrap, whatToDo);
  17:     Assembly a = Compiler.CompileAssembly(code);
  18:  
  19:     //get a type from the newly-compiled assembly
  20:     Type t = a.GetType("Georged.Compiled");
  21:  
  22:     // get static method information
  23:     MethodInfo mi = t.GetMethod("SomeInternalMagic");
  24:     
  25:     // drumroll... invoke the method
  26:     return (decimal) mi.Invoke(null, new object[] { d1, d2 });
  27: }

In this scenario, the only limitation on formula is that it:

  • Must refer to two input variables as d1 and d2
  • Must be a valid .NET expression of type decimal or of a type that has an implicit cast to decimal.

This is to ensure that, once the expression is inserted into the class Compiled, the resulting code is a valid .NET code that can be compiled on-the-fly. For example, the following expression will return the smallest of the two values:

d1 < d2 ? d1 : d2

Since the original idea was conceived, CRM 2011 Beta was released. While the original code should have worked unchanged, I could not resist the temptation to test new cool ways to write code. The result is good – gone verbose DependencyProperty declarations and CRM-specific data types, the code has shrunk and is much more readable now.

There is another, much more important reason to re-write the code. While custom workflow assemblies do work with CRM 2011 workflow, they are hopeless when it comes to dialogs, which is an awesome addition to the CRM toolbelt. Using the custom assembly above it’s not difficult, for example, to add a sophisticated mortgage calculator baked directly into the dialogs for a finance company call centre.

This Visual Studio 2010 project requires .NET 4 framework and CRM 2011 SDK. And, of course, CRM 2011 Beta to deploy.

If you’d like to take this code for a spin with CRM 4.0, this Visual Studio 2008 project requires .NET 3.5 and Microsoft CRM 4.0 SDK to build.

The usual warnings apply: use at your own risk, swim between the flags, choking hazard – small parts – not suitable for children under 3 years.

But wait, there is more! Sales tax and freight calculations often are quite complex and location-dependent. Creating a workflow that would correctly calculate taxes and freight charges in all circumstance is a formidable task. So how about storing the external (and hopefully thoroughly tested) code inside a custom entity and then use dynamic strategy to calculate tax and freight on the invoice where you can adjust calculations without recompiling, publishing or deploying anything! Unfortunately, the code too large to fit in the margin and will have to wait until next time.

Happy coding!

George Doubinski

Using Microsoft Dynamics CRM to do Simple Calculations

September 27, 2010 Leave a comment

CRM workflows can be used to do simple calculations. I have come across many users who are not aware of this feature and thought it would be a good topic for a blog. In this example, the workflow is doing a simple calculation.

Before you build this workflow, add an attribute called Weighted Revenue of type money to the opportunity form.

Now Create a workflow that calculates the weighted revenue value from Est. Revenue and Probability. In CRM we capture probability as a whole number so Weighted Revenue = Est. Revenue * (Probability*0.01).

Set Weighted Revenue to Probability:

Multiply the value in Weighted Revenue field by 0.01. This is done using Operator “Multiply by”:

Now Multiply Weighted Revenue field by Est. Revenue:

 <Editor note> This is so simple and an awesome way of calculating the weighted revenue. I absolutely love this. For the kicks, we actually tried this out and it took us just 4 minutes to implement this solution.

Cheers,

Shilpa Sinha

What makes you a valuable CRM talent?

August 27, 2010 Leave a comment

This keeps coming up in many places, so I decided to write up my thoughts in one place.  I read a lot of resumes, I hire people for our company, I know a lot of people in this industry.  Today, regardless of industry, you need to be more than a one-trick pony.

From what I’ve seen the economy is heading up and on a path to recovery.  Firms are ready to invest, but maybe still a little gun-shy.  So it’s important for them to make good decisions about technology choices, so what better than a fast to market Microsoft Dynamics CRM solution?

For any CRM solution/customization implementation you have a few primary roles needed.  Keep in mind not each implementation will have an individual associated with each of these, however the skills are needed in some form.  The key to employability is to be able to fill more than one of these roles with your own professional skill set.

  • Data analyst– this person needs to have a grasp of the needs of the client and the ability to translate that to CRM functionality.  The deeper the level of customizations the more involved of a business analyst you need on the project. It is important to be able to know the difference between what the client asks for and what they really need, all in the realm of CRM capabilities.
  • CRM customizer– this can be as simple at the label changes, but can also extend to custom entities, attributes, views, reports and workflows.  This person doesn’t have to know code, they have to know CRM.
  • CRM coder– you know where, when and how to place custom code in CRM.  You know WHAT code to place.
  • CRM architect– not only do you know the moving parts, you know how they move together, when and where you can and should interfere with the defaults to make your solution better.
  • CRM report writer- this person picks up where the built-in wizard ends.  I’ve had projects that this person is the busiest of all, and has the most extensive project knowledge, this person cannot be under-rated.
  • External webmaster– when your CRM grows and has the external component, your portals, etc.  Someone needs to manage this, implement this.
  • The CRM Infrastructure expert/guru. This person is often employed by the client and supported by the partner depending on size of firm. The CRM Infrastructure expert knows how to configure the e-mail router, knows how to teach the internal programmers about localhost. shares in the build and deploy best practices.
  • Standard project manager and QA resource should be included.

Each of these roles has a different level of technical skills required.  The more of these roles that YOU can do (and do well) the more employable you are AND the higher pay you can demand  (one biz analyst with customization skills at $125k is cheaper than 2 people at $75k, no?).  The one of these that I think is the most difficult is the business analyst, with the architect a close second.

I’m sure I don’t have all the roles needed, just the ones I see most often.  At some level for every CRM project we do, I play the role of each of these to some degree except for the coder.

Cheers,

Julie Yack

Tip o’ the Day: Quick Codeless Auditing Tool

August 18, 2010 Leave a comment

The workflows in Microsoft Dynamics CRM 4.0 are very powerful. Here is an example of an auditing tool which can be implemented without code, without additional attributes or additional entities and if you just need an audit log to roll back when people make mistakes, it should do the job.

Step 1: Setting up the Workflow

The workflow is pretty simple. All you do is create a note when a new record is created or when a specific field is changed.

In this case I’m auditing the first name attribute of the Contact record. The details of the note are thus:

That’s 90% of the work now done. We publish and the engine is in place.

Step 2: Make some changes

When we create a new contact or change the ‘First Name’ field, a new note will be created against the contact showing the current value. To determine the previous value we look back through the notes.

If there are extensive notes, we can use Advanced Find

We can even save the Advanced Find as a View and while there is no simple way to access the log through the interface, we can always go to Advanced Find – Saved Views.

Each time you need to audit a new field you just create a new workflow. If you are monitoring many fields, a plug-in may be a better option but if you need an audit tool to manage a few key fields and don’t want to spend a lot of time messing about, this should do the trick.

Cheers,

Leon Tribe

Microsoft Dynamics CRM Resource Center Redux

The Microsoft Dynamics CRM Resource Center for 4.0 and Online has become a very popular place to find information. The following tables highlight the top videos for CRM Online and CRM On Premises last month.

 

CRM Online: Top 5 Videos in June
Accept an invitation to Microsoft Dynamics CRM Online
Account basics
Take a tour of Microsoft Dynamics CRM
Importing customer data
Getting started with leads

 

CRM On Premises: Top 5 Videos in June
Set up your product catalog
Work with mail merge and mail merge templates
Create a simple workflow
Create and apply e-mail templates
Create and run duplicate detection rules

 

It is also worth noting that the Resource Center for CRM Online was successfully published into three new languages:

A big thanks to Andrew Becraft, Amy Langlois, Satish Kadam, Josh Chang, the Editing team, SE and Service Delivery team, and the Localization team for all your hard work and perseverance. (And to anyone else who I’ve forgotten to mention. Thank you!)

Renee Wesberry