How to Hide/Show fields on Advanced Find’s Search Criteria

One of my client requested to hide/Show some fields on MS CRM 4.0 (Microsoft CRM 4.0) Advanced Find search criteria. When this requirement came to me, I thought it is very hard to be implemented. In fact, this is a configuration issue and it is very easy to be implemented. all what you have to do is the followings:

  1. Go to customization area

  2. Open the entity that have those fields

  3. Go to Attributes on the left hand side

  4. Open the attribute (Field) you want to Hide/Show on the search criteria when you use Advance Find
    There is a field Called Searchable ; if you make it True, then you will be able to see this field on advance Find Search criteria, if you make it False, then you will not be able to see it.

  5. Save your changes.

  6. Publish customization

Audit MS CRM 4.0 Record Changes

It is common requirements to audit changes on certain entities on MS CRM 4.0. Unfortunately there is not built-in functionality to do so shipped out of the box. The best solution to solve this issue is to build a plug-in to take care of auditing changes. One of the challenges I faced is: How to implement this plug-in in generic away? So when my client ask me to audit a new entity, I will be ready for that with no Development effort.
The best solution I found to solve the issue is to build a generic entity to hold on your audited information. This entity should be generic enough to hold any kind of info you need…
I found a good plugin on internet and I used it.. It is pretty good to audit the chanag4es on CRM data. Please refer to the below link:
http://code.msdn.microsoft.com/auditing4crm

Decorator Design Pattern

Introduction:
Sometimes you want to add more responsibility to an object dynamically. Decorate Design Pattern provide us a flexible alternative to creating subclasses to extend this functionality. So you will not have to extend functionality by creating a child (Sub class) class.
Example:

DecoratorDesignPattern

class Program
{
static void Main()
{
Book b = new Book();
b.BookName = “Book Name”;
b.AutherName = “Auther Name”;
b.NumCopies = 10;
b.Display();
Movie v = new Movie();
v.VideoName = “Some Video name”;
v.VideoDirector = ” a Director”;
v.PlayTime = “1 hour”;
v.NumCopies = 10;
v.Display();
Console.WriteLine(“———————-“);
Console.WriteLine(“Borrow the book”);
BorrowLibraryItem borrow = new BorrowLibraryItem(b);
borrow.BorrowItem(“Yasser Jaber”);
borrow.BorrowItem(“Salah Jaber”);
borrow.Display();
Console.ReadKey();
}
}
abstract class LibraryItem
{
public int NumCopies{get;set;}
public abstract void Display();
}
class Book:LibraryItem
{
public string BookName { get; set; }
public string AutherName { get; set; }
public override void Display()
{
Console.WriteLine();
Console.WriteLine(“–> Book : “);
Console.WriteLine(” Author: {0}”, this.AutherName);
Console.WriteLine(” Book Name: {0}”, this.BookName);
Console.WriteLine(” Number of Copies: {0}”, base.NumCopies);
}
}
class Movie: LibraryItem
{
public string VideoDirector { get; set; }
public string VideoName { get; set; }
public string PlayTime { get; set; }
public override void Display()
{
Console.WriteLine( );
Console.WriteLine(“–>Movie : “);
Console.WriteLine(” Director: {0}”, VideoDirector);
Console.WriteLine(” Name: {0}”, VideoName);
Console.WriteLine(” Number of Copies: {0}”, NumCopies);
Console.WriteLine(” Playtime: {0}”, PlayTime);
}
}
class BorrowLibraryItem
{
protected List<string> borrowers = new List<string>();
protected LibraryItem item;
public BorrowLibraryItem(LibraryItem item)
{
this.item = item;
}
public void BorrowItem(string borrowerName)
{
borrowers.Add(borrowerName);
item.NumCopies–;
}
public void ReturnItem(string borrowerName)
{
borrowers.Remove(borrowerName);
item.NumCopies++;
}
public void Display()
{
item.Display();
Console.WriteLine();
Console.WriteLine(“Borrowers:”);
for (int i = 1; i <= borrowers.Count; i++)
{
Console.WriteLine(i.ToString() + “. ” + borrowers[i – 1]);
}
}
}

 

Download Code

Strategy Design Pattern

Introduction:
Sometimes you want your object to behave differently if its internal status changed. The strategy Design pattern enables client code to choose which behavior from a family of behaviors and give client code a simple way to enable that behavior.
Example:

Strategy

 

interface ISortStrategy
{
string Sort();
}

public string Sort()
{
return “0 1 2 3 4 5 6 7 8 9 “; //Simulate sorting algorithm
}

public string Sort()
{
return “9 8 7 6 5 4 3 2 1 0”; //Simulate sorting algorithm
}

class DataList
{
public ISortStrategy strategy;
public DataList(ISortStrategy strategy)
{
this.strategy = strategy;
}
public string GetSortedList()
{
return strategy.Sort();
}
}
static void Main()
{
DataList data = new DataList(new SortAcsStrategy());
Console.WriteLine(data.GetSortedList());
data.strategy = new SortDescStrategy();
Console.WriteLine(data.GetSortedList());
Console.ReadKey();
}

 

Download Code

Develop .Net 1.1 Web Application on windows Vista (IIS 7)

To develop Web application using .Net 1.1 and Visual Studio 2003 on Vista OS (IIS 7), follow the below steps:

  •   First of all you have to install Visual Studio 2003. this will install .Net 1.1 also

  •   Install all service packs for .Net framwork 1.1.

  •   Open the IIS Manager and navigate to the server root. (Not a website root, above that – the machine name.) and double click on "ISAPI and CGI restrictions."

  •   Add the v1.1 aspnet_isapi.dll to "Allowed" restrictions

                  (it’ll be at %WinDir%\Microsoft.NET\Framework\v1.1.4322\aspnet_isapi.dll)

  •   Navigate to the website root in IIS manager and double-click "ISAPI Filters."

  •   Add the ASP.NET 1.1 ISAPI filter from %WinDir%\Microsoft.NET\Framework\v1.1.4322\aspnet_filter.dll

  •   Go to the website root again in IIS manager and loo at "Advanced Settings."

  •   Ensure the website is using an ASP.NET 1.1 Application Pool (Vista created one for me when I installed .NET 1.1 – you may need to create one yourself.)

    Done.. Now you can develop and debug .Net 1.1 Web Applications on Vista OS and IIS 7.0

    Autocomplete (IntelliSense) While Writing SQL Statements; How Nice is SQL Prompt

    As a .Net developer who using Visual Studio from early morning till late evening, I like the way MS designed the IntelliSense feature there. and I was so disappointed because there is no such a feature while you are using SQL Server Management Studio.

    In version 2008 of SQL server Management Studio, MS solved the IntelliSense issue there but that was specifically if you are connecting to SQL Server 2008 backend engine.But I still need to use this feature while I am using SQL server 2000 and 2005 SQL server engines.

    I found a very good software from Red-Gate called SQL Prompt, this software is doing a very nice job for me and solved all of my issues related to IntelliSense.

    I have been using this software for 3 years till the moment I am writing this article, and I am still believe on it and if I start writing SQL statement without using it, I feel my life like a hell.

    For me the IntelliSense feature of  SQL Prompt is much better than the one that MS developed on SQL server 2008. and Red-Gate is keeping enhancing it and making it much better everyday.

    Code snap it on SQL prompt is amazing and saving my time a lot. You can define a keyword and its related SQL statements, once you type this keyword and then tab out, SQL Prompt will place the related SQL statements for you. For example, if you type “ssf” and tab out, SQL prompt will replace it by “SELECT * FROM “

    As a conclusion, I would strongly recommend to you to use it during your daily development day.