Monday, February 23, 2009

CRM 4.0 Picklist Generator Tool

Hi everyone,

To generate the picklist options in the application I work on, i'm always using the CRM 4.0 Picklist Item generator created by http://marioraunig.blogspot.com/, which I think is a great tool - quick and easy!

Often however I find that I need a few more features and so i've written my own utility for generating these codes, which over time I plan on adding more features too.

Find it here:

http://www.codeplex.com/CRMPicklistGenerator



For the moment, I've added the following features which I've found useful....

1. You can specify which number to use as the picklist value.
2. Options are specified as

[value], [description]
OR
[value],"[description]"

where [value] is the underlying value (int) and [description] is the pick list option description that's shown to the user.

3. You can sort by the description (deals with comma's in description as well).
4. You can specify which language code you want the list to use.
5. Allows comma's in descriptions and removes quotes

In order to use it,

1. Generate the option list
2. Open up your customization.xml file in Notepad or Visual Studio
3. Find the appropriate section of the xml file
4. Paste the generated option list into the xml file
5. Re-import the customization.xml file.

Anyway, hope it's handy for someone out there...

Cheers

Matt.

Monday, January 19, 2009

Update Rollup 2 for Microsoft Dynamics CRM 4.0

It looks like Microsoft have release the second rollup package for Microsoft CRM 4.0 in only a matter of months! 

I only hope that CRM 5.0 comes sooner than expected too :)

Find the information here and the download for the rollup package here


Tuesday, December 16, 2008

Host [Name] failed while starting monitoring asynchronous operations queue.

I've started working on some Microsoft Dynamics CRM development lately, and came accross this issue with on of our servers when the CRM Asyncronous Service stopped:

Host [Name] failed while starting monitoring asynchronous operations queue.

If you have the ApplicationServer and PlatformServer installed on the same machine, you may receive this error (in the event log) when you try and start the service

Host SGCORPCRM1: failed while starting monitoring asynchronous operations queue. Exception: System.InvalidOperationException: The requested Performance Counter is not a custom counter, it has to be initialized as ReadOnly.
at System.Diagnostics.PerformanceCounter.Initialize()
at System.Diagnostics.PerformanceCounter..ctor(String categoryName, String counterName, String instanceName, Boolean readOnly)
at Microsoft.Crm.Asynchronous.PerformanceCounters..ctor(String instanceName)
at Microsoft.Crm.Asynchronous.AsyncService.OnStart(String[] args)


I'm not sure how this happenned, I had a look for answers and found a Microsft KB on the problem - which was similar, but this did not seem to be applicable.

After some more searching, I finally found a post in the eggheadcafe forums , which came up with the goods (thanks Deepak!). Of course, before applying this fix, I checked a working server first, and found that the RoleNames and Roles registry entries were infact incorrect.

Below I've repeated the steps, hopefully making it easier to find for other with the same issue.
Open the registry and go to the path HKLM\SOFTWARE\Microsoft\MSCRM

  1. Check the 'RoleNames' value and the 'roles' value - they should be set to the following values "ApplicationServer,PlatformServer" and "2392107" ( do not include quotes)
  2. If the values do not match these, correct them to be the same
  3. Repair the CRM Installation
  4. Restart IIS The service should start successfully now.

Friday, December 5, 2008

LINQ to SQL Entity Base Version 1.0 Final

Hi everyone,

Now that all the bugs seem to be ironed out in the the LINQ to SQL Entity Base class, it's time to release it to the world as a final version.

If you have been using RC3, there is no need to update the source code from the Final release source code as it has not changed.

As with the RC3 release, I will stress again that you need Visual Studio 2008 SP1 and .NET 3.5 SP1 to run this final release verison as it uses one of the attributes for serialization not found in the original .NET 3.5 version.

Find the final version here:


Anyway, have fun!

Cheers

Matt.


Wednesday, October 22, 2008

Linq to SQL Entity Base Release Candidate 3

Hi everyone,

I've released a new version of the Linq 2 SQL Entity Base class which can be found here, along with details of the changes:

http://www.codeplex.com/LINQ2SQLEB/Release/ProjectReleases.aspx?ReleaseId=18662

I'm hoping this is the final release candidate that will become version 1.0 gold.

Cheers

Matt.

Friday, October 10, 2008

TFS - Fixing Work Item Updates made in Excel

One of the cool things about TFS is it's integration with Excel. The integration allows you to link work item data and publish it back to TFS, which is really handy for BA's, Team Leaders and Project Managers.

Unfortunately, with this feature comes the ability to make a huge mistake as well if you are not careful.

Recently, I had to find a way to revert 400 hundred work items which were unintentionally updated by one of the business team. They were using excel, copying and pasting from one TFS linked document into another and accidentally answered "yes" to the publish on the target excel document which resulted in every work items title and description being overridden.

Unfortunately, there was not quick and easy way to revert this so I had to figure out some way of doing it.

What I came up with was rather than trying to rollback the changes by fiddling with the TFS database (which is also a very risky thing to do) I thought that I would just override the mistaken records with the previous data (ironically with Excel - which is the same thing that made the mess!) and leave the invalid data in the workitem, so it would dissappear in the history.

Here's what I did:

  1. Queried the "workitemsare" table and the "workitemswere" table to find those records which were accidentally updated (looking at the change date field and the changed by field to find the right time of the incidient and user who publish the records).
  2. Found the previous version of the records by looking in the "workitemswere" table by comparing the records found in 1. above to the "workitemswere" table and finding the most recent update that occurent before the incident.
  3. From the results, build CSV file that could be opened in excel and be pasted over the top of a TFS linked document containing those records which were affected by the incident. It's important that both the excel documents (both the extract and the linked document) were in the same work item order and had the same columns that needed to be updated.
  4. Paste the correct values over the top of the bad records in the linked excel spreadsheet.
  5. Publish the correct values back to TFS from excel, resolving any issues where the new "correct" values broke any TFS workitem status state rules.

If you ever need to do this, here's a sample of the scripts which should get you started:

-----


-- Create a tempory table to put the data in
SELECT 1 AS Id,
fld10010 AS Priority,
State,
[Fld10094] ExternalSystemId,
[Assigned To],
Title,
fld10005 As [Resolved Date],
[Changed Date]
INTO #workingtable
FROM workitemsare
WHERE id = null


-- Grab the data that we are after and throw them into a temp table,
-- filtering by user and approximate time.
INSERT INTO #workingtable
(
id,
Priority,
State,
ExternalSystemId,
[Assigned To],
Title,
[Resolved Date],
[Changed Date]
)
SELECT id,
fld10010 AS Priority,
State,
[Fld10094] ExternalSystemId,
[Assigned To],
Title,
fld10005 As [Resolved Date],
[Changed Date]
FROM workitemsare
WHERE [changed by] = '[user name]'
AND [changed date] BETWEEN '2008-08-26 08:41:00'
AND '2008-08-26 08:42:00'
UNION
SELECT id,
fld10010 AS Priority,
State,
[Fld10094] ExternalSystemId,
[Assigned To],
Title,
fld10005 As [Resolved Date],
[Changed Date]
FROM workitemswere
WHERE [changed by] = '[user name]'
AND [changed date] BETWEEN '2008-08-26 08:41:00'
AND '2008-08-26 08:42:00'

-- select the correct records (finding the most recent change before the incident),
-- making sure that the column order and record order match that of excel spread sheet
-- you will use to paste over the top
-- (export this to CSV)

SELECT WIW.id,
ISNULL(CAST(WIW.fld10010 AS VARCHAR(10)), '') AS Priority,
WIW.State,
ISNULL(WIW.[Fld10094], '') AS ExternalSystemId,
WIW.[Assigned To],
WIW.Title,
WIW.fld10005 As [Resolved Date],
WIW.[Changed Date]
FROM #workingtable MWT
INNER JOIN [WorkItemsWere] WIW ON MWT.Id = WIW.Id
WHERE WIW.[Changed Date] = ( SELECT MAX([Changed Date])
FROM [WorkItemsWere] AS WIW2
WHERE WIW.Id = WIW2.Id
AND WIW2.[Changed Date] < '2008-08-26 08:41:00'
)
GROUP BY WIW.id,
WIW.fld10010,
WIW.State,
WIW.[Fld10094],
WIW.[Assigned To],
WIW.Title,
WIW.fld10005,
WIW.[Changed Date]
ORDER BY WIW.Id

----

Notes:

- Some of the fields have column values that aren't well named (auto genereated by TFS), to find where they are, look in the Fields table for the correct field/column mapping.

- WorkItemsWere, WorkItemsAre, Field tables can be found in the "TfsWorkItemTracking" database.

- WorkItemsWere table contains the previous states of each work item

- WorkItemsAre table contains the latest values for each work item

- DO NOT modify the TFS database directly!!!!


Cheers

Matt

Friday, August 8, 2008

Run Sun Java Application Server 9.1 on Windows Server 2003 as Service

I don't usually dabble in the Java world too much, but had to recently because a client required us to use a Java Solution and we needed to integrate with as part of our Windows Workflow Foundation. This solution Runs under Sun Java Application Server (SJAS).

Installation of the JAR file in SJAS worked fine as a Service and everything seemed to be going great. Right up until I logged off the server - this is where the service stop responding to calls but the service itself still beleived everything was working fine. This was weird because if you choose to install as a service, you don't expect it stop when you logout (i.e.the whole reason for having the "windows service" concept).

There seemed to be a lot of people out there looking for a solution to this issue, but no one seemed to have the answer (at least not for Windows 2003/SJAS 9.1 combination). Not even the vendor of the solution we were integrating with had a solution to this problem.

It turns out that the information is actually in the documentation for SJAS after all - which tripped me up because my searched kept taking me to the old 8.x version SJAS which doesn't include the extra special setting for Windows 2003, and following the 8.x version doesn't work.

Anyway, here's the information and a link to the Sun documenation - it's a bit of fiddling, but it works fine once you make these changes.

http://docs.sun.com/app/docs/doc/819-3671/ablwz?l=en&a=view&q=Restarting+Automatically


Preventing the Service From Shutting Down When a User Logs Out
By default, the Java VM catches signals from Windows that indicate that the operating system is shutting down, or that a user is logging out, and shuts itself down cleanly. This behavior causes the Application Server service to shut down when a user logs out of Windows. To prevent the service from shutting down when a user logs out, set the -Xrs Java VM option.

To set the -Xrs Java VM option, add the following line to the section of the as-install\domains\domain-name\config\domain.xml file that defines Java VM options:

-XrsIf the Application Server service is running, stop and restart the service for your changes to become effective.


And the all imporant bit...


Note –
In some Windows 2003 Server installations, adding the -Xrs option to the domain.xml file fails to prevent the service from shutting down. In this situation, add the option to the as-install\lib\processLauncher.xml file as follows:

<process name="as-service-name">
...
<sysproperty key="-Xrs"/>
...