With Microsoft Dynamics CRM necessity can definitely be the mother of invention. And using Microsoft Dynamics CRM Business Rules can help with the invention part . . .
Here comes the necessity
Our client often needs to gather information regarding forecasted surgical cases that could be captured at the Lead or at the Contact level. Much like the out of the box behavior for CRM that allows you to specify either an Account or a Contact as a Customer, our client needs to be able to select either a Lead or a Contact as they record their forecasted information. Pretty sure CRM doesn’t have a special system field that will let you do that!!
We’ve got to get both those lookups on the form and figure out how to guide the User into filling one in -- and only one. And, do it in a manner which is both simple and cost effective for our client.
Is this the mother part or the invention part?
You have to understand that my boss advocates above all else we take "care of our customers" and "keep things simple whenever possible". There are no doubt ways to use jscript to make sure that only one and not both -- Lead or Contact -- gets populated on the Case Forecast form. I’m not a developer so I started thinking about whether I could use jscripts simpler cousin -- Business Rules -- in some way.
Along those lines I had an epiphany! When you use required fields to enforce your data entry, CRM alerts you when you are missing data via error messages. Business Rules can have messages too. Error messages, but messages nonetheless.
I thought I’d at least futz around with it a bit to see if I could get the job done without getting our Developer involved. Yes, jscript is more elegant but there is no shame in using the tools you have out of the box -- right?
Getting their attention
So it didn’t take long to figure out that one way I could do this would be to throw an error message at the User right away. In the scenario for this particular client, we start out on load of the form with both the Lead and the Contact blank – why not yell at the User right there and let them know they better not even THINK about saving the form without providing a value for one or the other. ☺
Business Rules to the rescue:
It looks like this to the User (note that the message does temporarily cover up the Contact label and lookup control):
The User can’t save the record until they populate one of the fields. Once they do, we figured it would great to hide the other field so they can’t put data in both. We added a little bit more logic to the rule:
Is there a moral to this story?
You bet. CRM is like a Swiss Army Knife. Lots of tools in the box and even better, there is no rule that says you can’t try to use one of the tools in a different way than it was originally intended. You can do it too. Use Microsoft Dynamics CRM Business Rules to do things simpler, faster and with less expense than using jscript. Saved our client time and money. Oh, the client liked that!
By John Clifton, Microsoft Dynamics CRM Consultant with