Quantcast
Channel: Summit Group Software - how to
Viewing all articles
Browse latest Browse all 7

Calculated Fields and Microsoft Dynamics CRM 2015 - Part 1

$
0
0
Author: 
Josh Behl

For many versions of Microsoft Dynamics CRM, the need to concatenate, aggregate, or roll up information related to directly upon a record within the application has been a much needed and often requested by our customers. Until very, very recently, the typical answer was, “Yes we can, but <insert the conversation about the fact that you need to add code to do it>.” While some requests were inexpensive others took much more time and money to accomplish.  In Microsoft Dynamics CRM 2015, Microsoft has provided a fantastic feature that helps these types of requests seem much less daunting and far less potentially expensive in some cases: Calculated Fields and Rollup Fields.

AddHours         SubtractHours

AddDays           SubtractDays

AddWeeks         SubtractWeeks

AddMonths       SubtractMonths

AddYears          SubtractYears

Calculated Fields enable customizers the ability to take values on a particular record or related parental records and use them to perform an array of calculations. There are a number of built-in functions that enable you to perform date/time calculations such as:Calculated fields also provide the ability to leverage a variety of string functions such as:

  • Concat
  • TrimLeft
  • TrimRight

Basic mathematical formulas can be created as well such as division, multiplication, addition, and subtraction. In this article, we’ll introduce calculated fields by walking you through a basic AddMonths formula.

Calculated Field Example: 6 Month Anniversary Date

In this scenario, six months after a new account is created, they want to have completed the first sale to that customer and perform a number of other customer relationship activities. To accomplish this, it is important that they know what that date is. To accomplish it, we will create a calculated field on the Account entity that will add six months to the created on date and display that in a field we’ll call Six Month Anniversary Date. (To see all the steps taken, go to https://www.youtube.com/watch?v=qCJHRL8dXfM )

The first thing we’ll do is create a date/time field on the account entity. (I am making the assumption in this article that the steps to navigate to and create a field are something you are already familiar with). During the creation of the Six Month Anniversary Date field, there is one very important difference in the attribute creation process that we need to call out.

If you look at the screenshot below, you’ll notice that there is a new field on the attribute form:

The Field Type property provides you three options: Simple, Calculated, and Rollup. The default value is Simple. Equally as important is the fact that once you set this value and save the attribute, you cannot change it after the fact. So, make sure you accommodate for this fact in your design process.

Once you create the field and have identified the field as a Calculated Field, you can configure the calculated field formula and details. When creating the calculated field formula and logic, you can add conditions to the logic and subsequently identify what action you intend on taking. We’ll come back to conditions later. Let’s start by exploring how we create a formula.

Below, you’ll see a screenshot of the calculated field window. While we can add conditions to our formula, we’ll focus on the actions in this particular article. In this example, we will choose the ADDMONTHS formula. You’ll see that it requires to parameters: 1) the number of months you want to add and 2) the datetime field you want to add those months to.

The formula we’ll use in this example would look like this:

Once you have your formula entered, you’ll simply click the blue checkmark and click Save and Close.

From that point forward, you just need to add your field to the form, save, and then publish!

Below is an example of an account named SGS Testing, Inc. This account was created on 12/31/2014. You’ll notice that the 6 Month Anniversary Date field shows 6/30/2015…six months after the created on date.

In upcoming articles we’ll take a look at more examples of functions that can be used as well as discuss conditions and limitations.

To watch the video that walks through the steps in this article please visit: https://www.youtube.com/watch?v=qCJHRL8dXfM

Images: 

Viewing all articles
Browse latest Browse all 7

Trending Articles