Archive for the ‘CRM’ Category

CRM 2011– Customize Connection Role Category

by John Pavain | Jul 21, 2011

The new Connections feature that was added in CRM 2011 has proved quite useful and has replaced a custom Relationship Entity in a solution that I had built. I needed to create some new business Connection Role Categories  for a solution I was building for a client and had to do some searching around to find where to maintain them. Turns out that it is simple, they are contained in a global option set “Category”. Its very easy when you know where to look, just go to Settings>Customizations>Components>Option Sets and update the “Category” option set, it’s the only system option set  by default.


Categories: CRM Tags: ,

CRM Form Collapsible Sections

December 8, 2011 Leave a comment

//Add collapsible functionality to sections.

function attachCollapsableToSections() {
    var sections = getElementsByCondition(function(elm)
    { if (elm.className.indexOf("ms-crm-Form-Section") != -1) return true; }, null);
    for (var i = 0; i < sections.length; i++) {
        sections[i].innerHTML = ‘<img  alt="Expanded, click to collapse" src="/_imgs/navup.gif" style="cursor:hand;"/>’ + sections[i].innerHTML; sections[i].childNodes[0].attachEvent(‘onclick’, toggleVisibility);
function attachCollapsableToSections() {
    var sections = getElementsByCondition(function (elm) { if (elm.className.indexOf("ms-crm-Form-Section") != -1) return true; }, null);

    for (var i = 0; i < sections.length; i++) {

        sections[i].innerHTML = ‘<img  alt="Expanded, click to collapse" src="/_imgs/navup.gif" style="cursor:hand;"/>’ + sections[i].innerHTML;
        sections[i].childNodes[0].attachEvent(‘onclick’, toggleVisibility);


function toggleVisibility(e) {
    var sectionContainer = e.srcElement.parentNode.parentNode.parentNode;

    var elements = getElementsByCondition(function (elm) { if (elm.vAlign == "top") return true; }, sectionContainer);

    for (var i = 0; i < elements.length; i++) {
        if (elements[i].style.display == "none") {
            elements[i].style.display = "";           
            e.srcElement.src = e.srcElement.src.replace("navdown", "navup");
        else {
            elements[i].style.display = "none";           
            e.srcElement.src = e.srcElement.src.replace("navup", "navdown");

function getElementsByCondition(condition, container) {
    container = container || document;
    var all = container.all || container.getElementsByTagName(‘*’);
    var arr = [];
    for (var k = 0; k < all.length; k++) {
        var elm = all[k];
        if (condition(elm, k))
            arr[arr.length] = elm;
    return arr;

Categories: CRM Tags:

Microsoft Dynamics CRM 2011 Development Resources

August 1, 2011 Leave a comment
Categories: CRM

Disable an entire CRM Form

July 27, 2011 Leave a comment

Used to disable an entire form after a certain status has occurred:

for (var index = 0; index < crmForm.all.length; index++)
    if(crmForm.all[index].Disabled != null)
        crmForm.all[index].Disabled = true;

Categories: Coding, CRM Tags:

Hide Buttons on CRM Forms

February 15, 2011 Leave a comment

Need to hide the Actions and the save button on some forms.

I needed to find the id of the <li> tags for each button:

Save: _MBcrmFormSave’

Action Button: action


Once I had that, I added the following code to the forms onLoad() event:

var Hide = function(menuItem)
    if (document.getElementById(menuItem) != null)
        document.getElementById(menuItem).style.display = "none";
var RemoveSpacerAfter = function(menuItem)
    if (document.getElementById(menuItem) != null)
        var item = document.getElementById(menuItem);
        if (item.nextSibling != null)




Categories: CRM

Building a Common Approach to Grants Management

January 4, 2011 Leave a comment

Summary of what I’ve been working on for the last year.

Project Overview


The purpose of this project was to create a common grants management system for the North Carolina Department of Crime Control & Public Safety (CCPS) to maximize the use of federal grant funds to projects related to law enforcement, victim of crime services, emergency response and Homeland Security efforts. Initiation focus was given to the Governor’s Crime Commission Division (GCC) to administer all phases of their federal block grant programs that bring approximately $50,000,000.00 into the state’s criminal justice and juvenile justice system. The previous grant system was inefficient and labor intensive. Fiscal data preparations were performed in local access database files, excel spreadsheets, hand written notes and emails and then eventually manually entered into the central accounting mainframe. This labor intensive process creates multiple copies of the same data leading to duplication of work throughout the process. This also resulted in limited perspectives of grant information causing errors in grant awards: potential over-allocation of grant funds; larger than authorized check amounts written to subgrantees; under-utilized grant funding forcing money to be returned to the Federal Government along with under-utilized interest baring accounts limiting opportunities to extend grant funding to North Carolina criminal justice and juvenile justice systems.


Provide a single entry point and approach for all organizations requesting grant funding from all CCPS grant programs that have different grant application processes while ensuring fiscal management of funds are fully utilized and completely compliant with all federal auditing regulations.


The project provided a Microsoft SharePoint 2010 website for organizations requesting grant funding. This data is fed into a Microsoft CRM 4.0 solution that is tailored for each grant program. Once a grant project is awarded from any of the grant programs, the fiscal data is sent to a common Microsoft GP 10.0 solution. The fiscal solution provides accounts payable activities to be performed using a common fiscal focused software solution – minimizing training and maximizing common use of the tool. The system then automatically sends approved budget and check writing request information to the State’s Accounting Mainframe system eliminating the need for manually data entry. All interfaces between these system are managed by SCRIBE Insight software.

The implementation of a common fiscal grant management system will ensure all fiscal roles will be able to utilize information without the need to duplicate data entry or drive fiscal grant management workflow based on personnel rather than fiscal process.

Social Benefit

It provides management the ability to ensure maximum utilization of grant funds. The more programs that can be simultaneously supported throughout the state will help reduce crime, improve crime victim services, allow for better response to an emergency and solidify our state homeland security strategy.



GEMS SharePoint Home Page


GEMS CRM 4.0 Solution




GEMS Microsoft GP

Updated SRS Report for Project

December 22, 2010 Leave a comment

Forgot how I did this so I’m bloggin it:

1) Login to remote system with A.D. credentials that will allow you to run a CRM FilteredQuery Report

2) Open CRM and Edit Report from CRM

3) Download Report to a local location (e:\dev\custom reports)


3) Launched Report Builder 2.0



4) Update the DataSet1 query

5) Connect to database using SQL Server Management Studio on remote machine and connect with Windows credentials. This will allow you to run the CRM Filtered query successfully.

6) Copy – Paste query into New Query Window in SQL Server Management Studio

7) Adjust query till it is what you want

8 ) Save the query back into the Report.

9) I had to change the Data Source in the report to a embedded one. This allowed the new DataSet fields to refresh (I had a problem with my reports using the CRM shared connection)



10) Uploaded the new .rdl report in CRM



10a) If CRM throws an error, there is something wrong with the report. Go back to Report Builder and fix it.

11) Made sure the ‘Administration > ‘Viewable By’ was set to Organization




Categories: CRM, SRS Reports

Easy JavaScript Currency rounding function

December 21, 2010 Leave a comment

Had to use a quick rounding function today:


function roundNumber(num, dec) {
var result = Math.round(num*Math.pow(10,dec))/Math.pow(10,dec);
return result;}
Categories: Coding, CRM

Read-only and Disabled Fields

December 14, 2010 2 comments

Excellent explanation of setting read-only and disabled fields in CRM via JavaScript:

ReadOnly and Disabled Fields – Ryan Farley’s Blog

Let’s look at a few of the common types of fields:

Text and Numeric Fields (nvarchar, ntext, float, int, and money)

These types of fields are easy enough to work with. These render as a simple HTML input tags inside a table cell. The input control renders with an ID that matches the schema name. So for a field with a schema name of ‘new_textfield’, you can do either of the following to set it as readonly or disable it:

// set it as readonly 
crmForm.all.new_textfield.readOnly = true;
// OR set it as disabled
crmForm.all.new_textfield.disabled = true;

Picklist Fields

These render as HTML select tags. You can set these as readonly and disabled the same as you can with text fields (see above).


Things might seem complicated here, but for this purpose they are not. The control itselfs renders as a DIV and an IMG inside a table. The DIV shows the selected lookup value. This renders as a DIV to disallow any possible way to edit the value (all that is needed is the ID of the “looked-up” item anyway, the text is just for display). The IMG, of course, is the magnifying lookup image that you click to get the lookup list. Since the DIV is already uneditable by the user, all you need to worry about is the IMG. Luckily, the image will have the schema name as it’s ID value so no need to dig for the info of what to change. For a lookup named ‘AccountLookup’ you would simply do the following:

// disable lookup field
crmForm.all.new_accountlookupid.disabled = true;

Categories: CRM, Development Teams

Workflow Scope and Security in Microsoft Dynamics CRM

December 13, 2010 Leave a comment
Categories: CRM Tags: