Thursday, July 17, 2008

Display Database Image in SSRS from Northwind demo database.

If you’re reading this, then like me you probably fiddled around for an hour or so, scratched a hole in your head and wondered how such an easy job can be so impossible.

We’re building a SQL Server Reporting Services report that displays an image retrieved from a database field. This is easy.. Assuming that you already know how to build a simple SSRS report, to add a database image, simply select the image field into your dataset, drop an image control onto your report and select its “value” to the value of the image field from your dataset.

If you try this using the SQL Server version of Northwind, you’re sure to have trouble. The image will not display and you’ll get a little red cross in the control.

After a quick google search I came across these sites:

Robert Porter speaks the fact that the images saved in the Northwind database are not standard GIF formats, but OEM. Basically caused by converting a MS Access database to SQL Server. There’s also some sample there, but that didn’t work for me. Eventually after a lot more research and help, we have this line of code that converts the OEM GIF image into one readable by SSRS:

System.Convert.FromBase64String(Mid(System.Convert.ToBase64String(Fields!Photo.Value), 105))

If you must use Northwind’s original data to display an image on an SSRS report, then use the above line as the image value. Any other SQL Server image field would not need this and will work just fine by simply using the plain field value.

Monday, July 14, 2008

Set the State/Status of A Custom Entity in CRM 4.0 in VB

In addition to Catherine Eibner's post below on setting the satus of a custom entity in C#, I'd like to help the more logical programmers out there by posting the VB version..

Catherine Eibner: Set the State/Status of A Custom Entity in CRM 4.0

'This will set a task as complete
Dim SetTaskState As New SetStateTaskRequest
SetTaskState.EntityId = MyTaskGUID.Value
SetTaskState.TaskState = TaskState.Completed
SetTaskState.TaskStatus = -1

'This will deactivate a custom entity
'Note the SetStateNew_customentityRequest while the name of the
'entity is new_customentity.
Dim SetCustEntityState As New SetStateNew_customentityRequest
SetCustEntityState.EntityId = MyCustomEntityGUID.Value
'Note New_customentityState when entity name is new_customentity
SetCustEntityState.New_customentityState = New_customentityState.Inactive
SetCustEntityState.New_customentityStatus = -1

Friday, July 11, 2008

Server was unable to process you request | CRM SDK Error Handling...

Using the CRM 4.0 SDK to write a callout and you get the error massage "Server was unable to process you request".

CRM Throws SOAP Exceptions from the Web Service. That's why you need to use the following to get to the actual error...


Catch ex As System.Web.Services.Protocols.SoapException
MsgBox(ex.Message & " : " & ex.Detail.InnerText)
Catch ex As Exception
...More exception handling logic...
End Try


//Exception handling
//Exception handling

for MSDN's official documentation on CRM 3.0

Thursday, July 10, 2008

Customize CRM Logo image and colors...

I've spent a fair bit of time looking for ways to change the CRM header logo and page color... My final conclusion is that it is entirely unsupported by MS. Never the less, it is possible to customize your pages to suit your client/company look and feel.

Note carefully though, that these changes are completely unsupported and may be overwritten by service packs and/or hotfixes in the future.

CRM is essentially just a website with masses of .Net pages and SQL Server as its engine, its very easy to hack its content. Now, I would suggest strongly that you at least take a backup copy of every file you are about to modify or better yet, take a backup of the entire folder BEFORE you start.

Changing the CRM Logo to your company logo...

There generally seems to be multiple copies of files slightly different from one to the other.

The easiest way is to go to your CRM installation's website files, typically C:\Program Files\Microsoft CRM\CRMWeb. This is where all the .Net files and images are stored.

The main logo image is C:\Program Files\Microsoft CRM\CRMWeb\_imgs\masthead.jpg along with masthead_live.jpg, masthead_live_rtl.jpg and masthead_rtl.jpg for various situations. You will also need to modify the file mast_back.gif. This image allows for resizing of the window.

Simply replace these images with your own copies to the same dimensions. and you now have your own branded CRM. That was the easy part.

Alternatively, you could modify the page(eg C:\Program Files\Microsoft CRM\CRMWeb\_common\styles\global-dynamic-styles.css.aspx) that calls these images, but logically, I think it would be safer an easier to just replace the images.

Changing all pages to suit your company's look and feel...

Now you want to change CRM's standard blue, outlook feel to suit your business.

This part of the job is massively time consuming. There are proximately 46 million aspx, css, xml, xsl... files and images within the CRMWeb folder. You need to visit each one individually and change any reference to a color to your own equivalant one. There doesn't seem to be a very good standard of colors used in CRM and you'll notice that there are 46 million slight variations of a similar shade of blue in each file. It almost as if they've done this on purpose to discourage developers from touching it!?!?!?

I suggest that you gather maybe 6 different shades of your own colors and systematically replace each CRM shade of blue. Every change is live upon saving, so you can check the resulting page instantly. Once all web pages have been visited, its time to modify each of the 46 million images(within the _img folder).

You should expect to spend 2-4 days depending on how finely you need it tuned.

NOTE: Occasionally the client browser may not update to recent changes and may need IE temporary files to be cleared.
Hi.. I'm glad to introduce myself as another cursed blogger in this blog saturated world. After years of relegation I've decided to join you all.

Mostly for the reason that I find much of my resources as a result of other kind people's blogs. As karma would have it, I best pay back the community they way it has aided me. I hope my blogs turn out to be of some use to somebody out there as yours have to me...

If anyone reading my posts has any comments, questions, suggestions or corrections, it would be my pleasure to hear from you.

Thankyou All, Bloggers..

Kiavash Shakibaee