Adding search to Dynamics CRM Customer Portal

So I needed to add a search box to a Microsoft Dynamics CRM Customer Portal. So into Visual Web Developer 2010 Express I went. I opened the Customer Portal project and then expanded Pages and eService in the tree.

Opening up ViewCases.aspx I located the following


I added this before that:

              Search: 
        

I then opened the code for the file (right clicked and showed code) and located the following:

if (casesByCustomer.Count() == 0)

and added before that:

            if (!string.IsNullOrEmpty(CaseSearch.Text))
            {
                casesByCustomer = casesByStatus.Where(c => c.Title.ToLower().Contains(CaseSearch.Text.ToLower().ToString()));
            }

Saved the files, built the code and tested. Everything worked just fine, except for an error that occurred because the view I had, used follow up by and some of those cases didn't have them. If a search returned only results with no follow up by set, it would give an error. But I just swapped out the follow up by for modified on.

Leave a Reply

This site uses Akismet to reduce spam. Learn how your comment data is processed.