Home > Microsoft

This afternoon I was at the Microsoft Dynamics CRM booth at Convergence when someone asked me about required fields in CRM 2011. They wanted to know how to make fields required, but have different forms with different required fields for the same entity.

First, in CRM 2011, when you make a field required by editing the field, you are making it required for all forms (that the field is on).

If you want to make a field required just for a particular form, you can use a form onload event to change the requirement level. One of the great things about CRM 2011 is just how much is exposed to JScript through Xrm.Page. There are methods on the attribute to get the required level and set the required level. Let’s suppose for example that we want to make the First Name required, but only on this form, then we could use the following onload function with the parameters ‘required’, ‘firstname’ to make the field required. If we needed to add multiple fields, then we would just specify them after ‘firstname’, such as ‘required’,'firstname’,'address1_city’.

function updateRequirementLevel()
{
    var level = arguments[0];
    for (var i=1; i < arguments.length; i++)
    {
        var attribute = Xrm.Page.data.entity.attributes.get(arguments[i]);
        attribute.setRequiredLevel(level);
    }
}

That will make each field you specify after the level, required or recommended based on the level you pass as the first parameter. Calling the function updateRequirementLevel('required','firstname'); will make the firstname required.

Click Here To View Post With Syntax Highlighting

Do you want a drop down box for the state, but you don’t want to break core CRM functionality?

In CRM 4.0 I had posted an article about changing the CRM Address State to a drop down box. I have went back and updated the code a little (fixed a bug) and it will work with CRM 2011.

Ok, this script uses the same methods I used in CRM 4 to show the states for the United States and Canada (You can always modify it to have more options). This will help restrict what people put in the state field by providing them a drop down box. It will also allow them to view the old text box and enter any custom information just by clicking on ‘* ENTER A CUSTOM PROVINCE *’.

This script will work on the onload for a lead, contact, account, and sales-contact.

Click to continue reading
Click Here To View Post With Syntax Highlighting

The CRM Workflow Manipulation Library is now on CodePlex. The CRM Workflow Manipulation Library for CRM is a set of custom workflows for OnPremise Microsoft Dynamics® CRM to solve equations, manipulates strings, perform regex (regular expression) formatting and matching, as well as SoundEx and Metaphone-Like codification.

Click to continue reading
Click Here To View Post With Syntax Highlighting

Bing Maps are great. You can geocode and correct your addresses. While this isn’t anything complicated, it is a good example of a custom workflow that uses an external webservice.

Click to continue reading
Click Here To View Post With Syntax Highlighting

Unfortunately, CRM does not currently support adding the queue to a case advanced find. However, that doesn’t mean it can’t be done. Follow the steps in this article to modify your fetchXML and your layoutXML to have the queue name show up in the advanced find.

Click to continue reading
Click Here To View Post With Syntax Highlighting

Do you need the value of a lookup? I have written this bit of code to look a lookup value stored on another entity. Like finding the Customer lookup on an Incident (Case). Here is a bit of code that can lookup a lookup on any entity in CRM.

Click to continue reading
Click Here To View Post With Syntax Highlighting

Need to reference an external javascript file to make functions available in change events and in an onload? Here’s how!

Click to continue reading
Click Here To View Post With Syntax Highlighting

Here is a video tutorial of how to take a case advanced find, edit the query, troubleshoot errors in SQL Management Studio, and update your excel query.

Click to continue reading
Click Here To View Post With Syntax Highlighting

Recently on the Microsoft forums someone asked how to change the values of a picklist based on the yes no value of a boolean field. Just add this script to the OnChange event of the yes/no field.

Click to continue reading
Click Here To View Post With Syntax Highlighting

© 2011 MSCRM Blogger

This site does not necessarily represent the views of Microsoft. The material posted on this blog are provided AS-IS, and you are to use the content at your own risk. Some of the code and information on this site may use unsupported methods. If you experience any problems using the information provided through this website, please post a comment and we will do our best to assist you, however, we can in no way guarantee support or resolution.

Microsoft Dynamics®, Silverlight®, Visual Studio®, and the corresponding logos are a registered trademarks owned by Microsoft Corporation. MSCRM Blogger has made every effort to supply trademark information about company names, products, and services mentioned on this blog. All third party trademarks are the property of their respective owners. Any rights not expressly granted herein are reserved.