Monday, March 07, 2011

MSCRM 4.0: Customize the Lookup View of Role Entity

In my current project, I developed a custom workflow called IsUserInRole which helps determine whether a user is in a particular role. It all worked fine, until we deployed the workflows to our UAT and production environments.

Let me try to explain what the problem is. The custom workflow has a lookup input parameter for Role entity which allows the business user to specify a CRM role to test whether the current user or a specified user has that particular role. In our local VPC development environment, we tried to keep everything simple, we only had a root business unit for the CRM installation. So the IsUserInRole workflow can show all the roles in the CRM system without any confusion. But in our UAT and production environments, we had more than one business unit, so all the roles that we created in the root business unit were automatically copied to the child business units, which caused significant confusion for the CRM workflows that used IsUserInRole workflow. When we were trying to use CRM lookup to pick a role, we got something like the following screen shot, which you could see a number of roles in the same name but they actually belonged to different business units. This created a challenge for us, as we could easily pick a wrong role, so that the custom workflow would not function in the way that we expected.
CRM Default Role Lookup View
I first thought this would be an easy job, as CRM allows us to define almost any views. But when I fired up the customization page of Role entity, I realized that is a totally different story, CRM didn't provide a way that allows me to customize any view for role entity. I went on thinking about using exported role entity customization xml file, but I hit a wall again as I noticed that the role entity customization XML file was almost empty, it had no view information or whatsoever in the export xml file.

After a little struggle, I realized that I might be able to take a shortcut by directly typing in CRM view customization page's URL with the view's ID. So I took a peek of CRM database using the following SQL query.
 SQL Query for Role Lookup View
After running the above SQL script, I have got the view's ID. What I need to do next is, go to a customizable entity, and double click one of its views to launch a view customization page, and I press Ctrl+N key to launch the page in a new window so that I can have IE address bar. Then I replace the ID parameter in the address bar with the view ID I have just got from previous SQL query, so that I have a URL in the following format.

http://<CrmServer>/<CrmOrganizationName>/tools/vieweditor/viewManager.aspx?id={61F8D435-8E25-4751-8330-5969506EF536}

As soon as I have the above URL typed in and hit my browser's Go button, I get just a regular view customization screen. Whew!
Edit CRM Role Lookup View
You might already know, as soon as we get to this point, the rest is fairly easy. I added "Business Unit" column to the view using "Add View Columns" button on the right, and then published all CRM customization changes. After that, I came back to my custom workflow and I noticed that I could see the Business Unit column in the lookup view. 
CRM Role Lookup View with Business Unit Column
I believe this technique not only applies to the views of CRM role entity, you should also be able to use it to customize almost all views of core CRM entities such as Team, Queue, Workflow, etc., if you ever happen to have this kind of needs.  

Hope this helps.

P.S. I would have used a different solution for my custom workflow if I foresaw the problem of using Role lookup that I have mentioned, but I do hope this blog post helps if you ever come across similar needs in your project.

Sunday, March 06, 2011

Taking a Break, and Looking for Business Opportunities

After three years (3 years and 5 months to be accurate) of hard working days with my current employer, I decided to take a short break and give myself a little bit time to think about what I am going to do next.

As a quick retrospect of the last 3 years, I believe I have gained significant experience with Microsoft Dynamics CRM, SharePoint, .NET, and Enterprise Application Development. I worked hard, thought hard, and made sure that I have been doing the right thing for my project and the applications that I was developing. I tried to discipline myself by leveraging the best practices that I have learned from the community, which has been a great achieving 3 years.

March 31 is going to be my last day with my current employer, which means on April 1st, I will be jobless (What a April fool's day!).

We have a small local community of Microsoft Dynamics CRM development work in the city where I live. What this means is, I might have to go with different development practice, such as .NET, SharePoint (admittedly, I much prefer MSCRM when comparing to SharePoint) or even something totally different (maybe Ruby or Python). In other words, I might be leaving MSCRM community for a short period of time. But I will still try to keep an eye on Microsoft Dynamics CRM, particularly I will stay on Microsoft Dynamics CRM Development Forum by helping the community whenever I can find time.

Speaking about the business opportunities that I am looking for, I am listing what I can offer to help for MSCRM platform.
  1. Microsoft Dynamics CRM Development
  2. Microsoft Dynamics CRM Solution Architecting
  3. Microsoft Dynamics CRM Planning and Implementation
  4. Microsoft Dynamics CRM Data Migration and Data Integration
  5. Microsoft Dynamics CRM Document Automation and SharePoint Integration Solution
  6. Microsoft Dynamics CRM Development Training
When it comes to training, most people tend to overlook its importance. Microsoft Dynamics CRM is a complex business application platform, which requires quite steep learning curve. Training not only helps you save your investment, but also helps you get the job done faster with better quality. I have an extreme passion about writing quality software code (you may argue that I am actually writing poor code, but at least I am trying to be better everyday), so I think I can help build up your team resource in one way or another, by sharing the lessons and experiences that I have learned during the past years.

If you want to offer me a job or a contract work (it doesn't have to be MSCRM), please do so, I am very positive that I can help in certain ways. If in any case that you may want to offer me a technical executive position, you will have to buy me a cup of coffee so that we can sit down and have a talk. ;-)

You may reach me by my personal email at (danielwcai at gmail dot com).

Cheers!

[Update - Mar 23, 2011] I have decided to pursue a local contract position, which is not relevant to MSCRM. Thanks for your time. I apologize if this blog post has caused any confusions in the community.