Showing posts with label Test Environment. Show all posts
Showing posts with label Test Environment. Show all posts

Friday, October 30, 2009

Debugging CRM Plug-ins, Stored Procedures & Custom Workflow Activities

by Danny Varghese 02.24.09

Whether it's developing CRM plug-ins, custom workflow activities, or writing stored procedures against the CRM database, the most useful tool I've used is the Microsoft Visual Studio Debugger. The debugger allows developers to step through the code for the above mentioned scenarios and has saved me hours!

Microsoft has phenomenal documentation on how to setup remote debugging:

http://msdn.microsoft.com/en-us/library/bt727f1t.aspx

The biggest issues I've had trying to setup the debugger has always been with permissions. I would recommend paying especially close attention to this section. The next biggest issue I had was trying to attach the debugger to a running process: http://msdn.microsoft.com/en-us/library/c6wf8e4z.aspx

Once you've setup Visual Studio debugger, you can attach the following processes for the following CRM components:

  1. For plug-ins, attach the debugger to the w3wp.exe process.
  2. For custom workflow activities, attach the debugger to MSCRMAsyncService.exe
  3. For stored procedures, attach the debugger to sqlserver.exe

Once the debugger has been attached, you must set a breakpoint in the code (either the .NET or T-SQL code). After the breakpoint is set, to test, do the following:

  1. For plug-ins, login to CRM and execute actions that will trigger the plug-in, such as create/update/assign a record.
  2. For custom workflow activities, login to CRM and perform actions that will trigger the workflow. With this, being that it's an asynchronous service, you'll have to wait until that service runs, and then Visual Studio will let you step through the code.
  3. For the stored procedure, just execute the stored procedure in Visual Studio and it will go right to the breakpoint.

I hope this post will help CRM developers save time and effort. I use the debugger every time I develop now to test and it's saved me tremendous amount of maintenance time and effort after the code has been deployed. Happy debugging!

Wednesday, October 15, 2008

Setting up a “mirror” of a production environment for dev/testing

Posted by John Straumann

I recently needed to set up a “mirror” of a production system for use in development and testing. I had worked with the Redeployment tool in CRM v3 and I was interested to see how v4 worked. I was very happy when the v4 tool was *very* easy to use, and here are the steps I followed.

1. Used SQL 2005 to do a backup of the CRM v4 production databases
2. Using the VPC image distributed by Microsoft, I copied the .bak file to the VPC. I then did a restore of the database files to the VPC SQL instance. For some reason the SQL GUI did not work, so I used the following command (Names changed):
restore database OrgName_MSCRM from disk='C:\Temp\OrgName_MSCRM.bak' WITH MOVE 'OrgName_MSCRM' TO 'C:\Program Files\Microsoft SQL Server\MSSQL.1\MSSQL\Data\ OrgName _MSCRM.mdf', MOVE ' OrgName _MSCRM_log' TO 'C:\Program Files\Microsoft SQL Server\MSSQL.1\MSSQL\Data\ OrgName _MSCRM_log.LDF'

3. Once the DB was successfully restored on the VPC image, I fired up the CRM Deployment Manager, right-clicked on the “Organizations” item, and selected “Import Organization”
4. The next step asked me to specify the SQL server, and as soon as I did that the deployment manager found the organization I wanted to import
5. The next screen asked me for a name and a display name
6. Next input was the report server URL
7. The next steps involved the mapping of users. There are several options for this tep, I chose to simply “Manually Map Users”, and the only user I mapped was the Administrator which was mapped to the Litwareinc Administrator on the VPC. I got a warning that “All users are not mapped. Do you wish to continue?” and just clicked “Yes”
8. The next screen was simply the tasks verification screen, so I clicked “Next” and then on the next screen “Import”
9. And that was it! It took a bit of time and at the end I am able to access the org via http://moss:5555/orgname/loader.aspx

You can see the screens here but please note names are hidden:

http://www.mscrmguy.com/redeploy/redeploy.html

Monday, August 4, 2008

Setting up a “mirror” of a production environment for dev/testing

mscrmguy wrote this on Thursday, July 31, 2008

I recently needed to set up a “mirror” of a production system for use in development and testing. I had worked with the Redeployment tool in CRM v3 and I was interested to see how v4 worked. I was very happy when the v4 tool was *very* easy to use, and here are the steps I followed.

1. Used SQL 2005 to do a backup of the CRM v4 production databases
2. Using the VPC image distributed by Microsoft, I copied the .bak file to the VPC. I then did a restore of the database files to the VPC SQL instance. For some reason the SQL GUI did not work, so I used the following command (Names changed):
restore database OrgName_MSCRM from disk='C:\Temp\OrgName_MSCRM.bak' WITH MOVE 'OrgName_MSCRM' TO 'C:\Program Files\Microsoft SQL Server\MSSQL.1\MSSQL\Data\ OrgName _MSCRM.mdf', MOVE ' OrgName _MSCRM_log' TO 'C:\Program Files\Microsoft SQL Server\MSSQL.1\MSSQL\Data\ OrgName _MSCRM_log.LDF'

3. Once the DB was successfully restored on the VPC image, I fired up the CRM Deployment Manager, right-clicked on the “Organizations” item, and selected “Import Organization”
4. The next step asked me to specify the SQL server, and as soon as I did that the deployment manager found the organization I wanted to import
5. The next screen asked me for a name and a display name
6. Next input was the report server URL
7. The next steps involved the mapping of users. There are several options for this tep, I chose to simply “Manually Map Users”, and the only user I mapped was the Administrator which was mapped to the Litwareinc Administrator on the VPC. I got a warning that “All users are not mapped. Do you wish to continue?” and just clicked “Yes”
8. The next screen was simply the tasks verification screen, so I clicked “Next” and then on the next screen “Import”
9. And that was it! It took a bit of time and at the end I am able to access the org via http://moss:5555/orgname/loader.aspx

You can see the screens here but please note names are hidden:

http://www.mscrmguy.com/redeploy/redeploy.html