Friday, December 12, 2008

Your first Dynamics CRM WorkFlow Activity

This post show should act as a guideline to creating you first workflow activity dll for Dynamics CRM. It includes some gotachas I came across so hopefully it will save you some time.

Create a new workflow activity library in Visual Studio




You need to reference the CRM Micrsoft.Crm.Sdk and , Micrsoft.Crm.Sdk.TypeProxy dlls in your project.








Rename the class to a suitable name and add the lines
using Microsoft.Crm.Sdk;
using Microsoft.Crm.SdkTypeProxy;
using Microsoft.Crm.Workflow;

Add a decorator [CrmWorkflowActivity("MyFirstWorkFlowActivity", "ConcatStrings")] to the class which will determine how it appears to the user in CRM and add the the method below

protected override ActivityExecutionStatus Execute(ActivityExecutionContext executionContext) {return base.Execute(executionContext); }

Now sign the project at which point the bones of your workflow activity are in place.











In our example we will take two string parameters and and conconatate them into an ouput parameter add the code below. The decorator CrmInput and CrmOutput attributes determine which properties are visible in the CRM workflow editor. A property can be be set to both CrmInput and CrmOutput if required.




In our example we will take two string parameters and and conconatates them into an ouput parameter so add the code below

protected override ActivityExecutionStatus Execute(ActivityExecutionContext executionContext)
{
this.outString = this.inString1 + ", "+this.inString2 ;

return base.Execute(executionContext);
}


public static DependencyProperty inString1Property = DependencyProperty.Register("inString1", typeof(string), typeof(MyFirstCRMActivity));


[CrmInput("InString1")]


public string inString1
{
get { return (string)base.GetValue(inString1Property);}
set { base.SetValue(inString1Property, value);}
}


public static DependencyProperty inString2Property = DependencyProperty.Register("inString2", typeof(string), typeof(MyFirstCRMActivity));
[CrmInput("InString2")]


public string inString2
{
get { return (string)base.GetValue(inString2Property);}
set { base.SetValue(inString2Property, value); }
}


public static DependencyProperty outStringProperty = DependencyProperty.Register("outString", typeof(string), typeof(MyFirstCRMActivity));
[CrmOutput("OutString")]
public string outString
{
get { return (string)base.GetValue(outStringProperty);}
set { base.SetValue(outStringProperty, value); }
}



Build the project and copy the dll and pbl file to the C:\Program Files\Microsoft Dynamics CRM Server\Server\bin\assembly (assuming default install)


You now need to regsiter the DLL however do not use the registration tool that comes with the SDK use the version from
http://blogs.msdn.com/crm/archive/2008/02/04/crm-registering-plug-ins-made-easy.aspx




Once registered you can create a workflow in CRM which calls the new created dll
setting the input parameters in the first step and the output in the second



<


Gotchas - Here are a few problems you may come across


If you cannot publish your Workflow from CRM turn tracing on and check the trace logs

http://support.microsoft.com/kb/907490


Check if namespace and class the same as this will prevent the workflow from been published


ErrorCode: -2147201023 - the type in the dependency property is not correct


When redeploying you may need to stop and restart IIS and the CRM Asynch service so you can use a batch file or build script to execute the following
net stop w3svc
net start w3svc
net stop MSCRMAsyncService
net start MSCRMAsyncService

Another common problem

Could not create activity of type 'CorrespondenceWorkflowActivity.Correspondence'. System.ArgumentException: Type 'CorrespondenceWorkflowActivity.Correspondence' does not define a static dependency property with name 'inGuidProperty'.

http://blogs.catalystss.com/blogs/scott_seely/archive/2007/03/06/96.aspx

Tuesday, December 09, 2008

Dynamics CRM 5.0

If you want to have a look at the next version of CRM download the “The Appealing Business Application” presentation from the PDC 2008 and jump to 45 mins in

This covers the new UI, form layout and customization solutions. Learn who you will be able to create a base customization solution and lock it down allowing additional customizations to be made on top.

Saturday, December 06, 2008

Batch file to logon to Microsoft CRM as different users

If you want to run CRM as a different user to the logged on user either use the following line at the command prompt or copy it into a batch file. Change the userID and CRM server accordingly

runas /user:JoeGill "C:\Program Files\Internet Explorer\iexplore.exe http://localhost:5555/loader.aspx"

It is useful for demos to show different users at the same time.

Tuesday, December 02, 2008

SharePoint MTUG Talk 1st Dec 2008



Well done to Martin and Micheal who gave a great talk on SharePoint last night. There were almost 40 attendees there although Michael reckons its was 140!. There was so much to cover we could have run a series of talks on Sharepoint.

Thanks to perpetuum and Microsoft for sponsering the event


Monday, December 01, 2008

CS0433

If you are using Dynamic Data in ASP.NET to generate some basic entry web site you will get this error if you publish your web site and you have a form with the same name as a table in you data context class. e.g. Order.aspx and System.Data.Linq.Table Order.

No problem when running fron VS which sent me up the wrong path initially

Thursday, November 06, 2008

0x8ffe2740 IIS error and Skype

This is a port conflict error as the default install of Skype uses port 80 so if you install IIS and get this error you need to Skype->Options->Advanced Settings->Connection and uncheck the box that says use port 80 and 443 as alternatives

Tuesday, October 14, 2008

SQL Server Indexing Talk - Niall Flanagan


Niall Flanagan did a great talk to MTUG Cork on indexing and fragmentation in sql server last night. It was a good session and it went on for over two hours with lots of interaction.


Well done Niall

The materials from the talk can be found on the materials tab on the event Event

Tuesday, September 23, 2008

Linq to SQL MTUG Cork Talk




We had a great turnout for the Linq to SQL talk last night event and many thanks to Sidar for sharing his knowledge with us.

Dave Hegarty won the spot prize of VS 2008

The next event in Cork is on Oct 14 and Niall Flanagan, SQL Server MVP, will we talking about indexing and performance.

Thursday, September 11, 2008

Dynamic Data ASP.NET

Talking to a friend yesterday about Dynamic Data and it's potential I would recommend having a look at the videos on http://www.asp.net/dynamicdata/ as an introduction

Tuesday, May 27, 2008

Silverlight Talk

Paul Walsh of Torc Software gave a great talk on Silverlight applications last night. Paul is a regular attendee at the MTUG talks and we had a good turnout with some good interaction.

Hopefully we can get some more members to give talks to their local groups.





Wednesday, April 09, 2008

Microsoft Office Accounting Released in the UK

Not many people seemed to have picked up on the fact that Microsoft has released Office Accounting in the UK. It is available from http://www.msofficeaccounting.co.uk/ and the price is only 150GBP. There is also a free express version!

It will be interesting if Sage, etc try and get the EU commission to look at this to try and protect their market. Sage seems really expensive for small companies when you compare it to Office Accounting.

It does seem to be available in Ireland yet although it’s easy to change the vat rate to 21% from the UK default of 17.5%

There is also a SDK available at SDK

Monday, April 07, 2008

IMTC 2008

I attended the IMTC on Thursday and Friday and here some of my highlights.

I met lots of speakers and MVPs. Some have promised to come and talk in Cork next year.

Ben Sykes gave a great talk on what makes people tick and how we need to be aware of this when designing web sites or any type of user interface. Ben is a great guy and is shortly moving to Galway from Seattle to work for Cisco.

Dave McMahon gave an informative and entertains talk on SQL and opened my eyes to a few new techniques. He certainly pushed www.DDDireland.com on 3rd June!!

Office Communication Server is not really suitable for the small business market as it need lots of servers and there are no VOIP gateways for outgoing calls.

Lots of interest in LINQ but nobody seems to have used in anger yet.

Wednesday, April 02, 2008

WPF 1st April Oliver Sturm

Oliver gave a great talk on WPF last night we had a great turnout and with so many questions we ran way over time. Sorry no photos the battery died in my camera.

Oliver's company http://www.devexpress.com/ kindly dontated a prize of CodeRush and Refactor which was won by Ken Carroll

Thursday, March 27, 2008

Irish Microsoft Technology Conference 2008

The IMTC, Irish Microsoft Technology Conference, is on next week 2-4th April with lots of TechEd speakers attending more details on IMTC

Wednesday, March 12, 2008

MTUG Cork WPF Talk 1st April

Oliver Sturm blog is coming to Cork to do a talk on WPF with lots demos and code examples.

Click here for more details and to register Register

Oliver has provided a taster of this talk which can be viewed here

Wednesday, March 05, 2008

Great CRM tool to generate FetchSQL

I am currently getting up to speed with the Microsoft CRM 4.0 SDK and I came across this tool written by a guy called James Downey. I don’t James but this is a great tool which allows you to easily generate FetchSQL statements. http://www.jamesdowney.net/

Friday, February 29, 2008

Developer Developer Developer Ireland

Mick from the Galway user group, GAMTUG has done a mighty job in organizing the first Developer Developer Developer event in Ireland. This is being held in Galway on the May bank holiday and there are lots of TechEd speakers coming including Alex Homer and Dave Sussman. Have a look at the line up. http://www.dddireland.com/agenda-1.htm

This is will worth attending and the best thing is that it is free!

MTUG Cork Visual Studio 2008 Commuity Launch


This was a great event and we had over 150 attendees during the course of the day. Feedback on the speakers was great Dave, Bob and Ronan were entertaining as well as informative. Having spoken to a few members it looks like we will try and hold another event like this in the autumn. Running from 2pm to 8pm allows people who can’t get time off work to attend some of the talks.


Powerpoints from the events can be found under the materials tab on http://www.cork.mtug.ie/Events/EventInfo.aspx?ID=8013ae90-ffa5-4f65-9095-ebc49cd08b51