Calculated Fields in Dynamics CRM

Thinking Outside The Box: Leveraging Calculated Fields in Microsoft Dynamics CRM

Posted By

Occasionally I notice a new feature in my favorite software and think it’s really cool. But sometimes I just get bored with using the feature’s standard functionality, and I can’t come up with another way of using it.

Well, that was me with the calculated field within Microsoft Dynamics CRM customizations. It took me no time to figure out how to do math with the calculated field, and then I got bored. But one day, I had an absolutely brilliant moment! I found another way to use those calculated fields and the excitement about the new feature was back.

Prior to the release of calculated and roll-up fields in Microsoft Dynamics CRM, I frequently had to call up one of my team’s developers to get a quote for simple things, such as basic math on a form, or modifying related records based on a change to another record. But with Microsoft Dynamics CRM’s calculated field, I can now modify child records based on a change made to the parent record. So exciting!

Here’s what I came up with:

I have a header entity (for example, a Purchase Order header). It holds the basic information such as the vendor, date and total (roll-up from children records) of all the lines associated with this record. I also have an approval field (two-option set) with permissions set so only an authorized person can approve it.

Plus, I have a line entity (Purchase Order Lines) that holds the product, quantity, price per unit, etc., including a similar approval field (two-option set).

The action I want to complete: When I approve the header record, I want to automatically approve the lines. I also want to implement a business rule that locks the fields and prevents modifications.

Here’s how I accomplished it:

  1. I created the approval field on the line entity as both a two-option set field and a calculated field. This way, I could put in a condition stating when the Purchase Order’s approval field is “Yes”, it updates the Purchase Line field to “Yes”.
  2. I also added the negative condition. If the Purchase Order’s approval field is “No”, it updates the Purchase Line field to “No”.
  3. After creating this field, I then added a Business Rule to the Purchase Order Line entity that contained the scope of “Entity”. This business rule locked most of the fields on the record when the approved field is “Yes”, and unlocked the fields when the approved field is “No”.

I was excited to see the process carry itself out after I published these customizations.

When I approved my Purchase Order, it updated and locked all the fields on the Purchase Order Line. When I unapproved my Purchase Order, it unlocked all the fields identified on the Purchase Order Line and allowed further modifications.

And the two best parts? Unlike a workflow, it’s synchronous. This means I don’t have to wait up to 15 minutes for the changes to take effect in the system. Plus, I didn’t have to get a developer to quote anything for my design on record approvals. A win-win for me and my project manager!

A new approach to CRM for higher education
A new and improved approach to CRM for higher education from BDO IT Solutions. Click here to download!



BDO eBook - The Cloud Changes the Game

There are times in the course of your business when you have the opportunity to dramatically accelerate growth and improve day-to-day efficiencies. Recognizing