Monday, November 14, 2011

CRM 2011 Developer ToolKit

Recently Microsoft has developed Developer Toolkit for Microsoft Dynamics CRM 2011 that is integrated with Visual Studio to accelerate the development of custom code for Microsoft Dynamics CRM 2011 solutions. Microsoft Dynamics CRM developers can now write custom code from within Visual Studio by using tools and can automatically deploy that code to the CRM from within the visual studio itself.

The Developer toolkit for Microsoft Dynamics CRM 2011 can be downloaded from the Link http://www.microsoft.com/download/en/details.aspx?id=24004

Supporting operating systems are windows7,Windows server 2008.

- After downloading the exe run the crmdevelopertools_installer.msi.
- After successful installation open Visual studio 2010. New Dynamic CRM template will be installed as given in the below screen shot.



The benefits of Developer Toolkit are listed below.

- The Toolkit supports the create, update, delete and deployment of CRM Plug-ins, Workflows (both XAML and custom workflow activities), Silverlight applications and other Web resources including Jscript and HTML.
- Easily generate strongly typed proxy classes without having to run CrmSvcUtil.exe.
- Works with Dynamics CRM Online, On-premise and IFD deployments.

Let me discuss the components one by one

1) Dynamic CRM 2011 Package:1.1) In your new solution, the CrmPackage project is a manifest project that contains all components to be deployed to Microsoft Dynamics CRM combined with their deployment settings. By default, the outputs from each other project are added as references to this project in so that they can be deployed to the server.

So CRMPackage project is required if you want to deploy any component on the CRM server.



1.2) Components are added to the package by adding projects as a reference or by adding components under the WebResources folder.
1.3) The RegisterFile.crmregister contains registration information for plug-ins and custom workflows created by the toolkit. This information is used to register these components during deployment.

2) Plug-in Project:

The Plugins project contains a base class named Plug-in that implements the Microsoft.Xrm.Sdk.IPlugin interface. All plug-in classes generated through the Create Plug-in option of the CRM Explorer will derive from this class. This class simplifies some of the common code that is required by many plug-ins, including the following:

• Obtaining execution context from the service provider.
• Obtaining the tracing service from the service provider.
• Instantiating the Organization Service proxy.

Additionally, the validation method verifies several typical plug-in events and provides a pattern for the developer to extend.

Initially, the derived class’ implementation calls the base class’ implementation before continuing with its own, more specific implementation.

After validating that the plug-in should execute, the base class calls up to the Execute method of the derived class, passing through the execution context and Organization Service proxy.

Use the following procedure to create and deploy a plug-in.

1. Select the Project as given in the below screen shot.



2. User will be prompted for the following information. Specify the login information as well as Organization and the solution where you would like to deploy your components.



3. CRM Explorer is displayed in the visual studio where all the components of the organization specified will be displayed as given in the below screen shot.



locate the entity that you want to create the plug-in for. Right-click the entity and then select Create Plug-in as given in the below screen shot.

User will be prompted for the information’s as given in the below screen shot where we have to give information regarding the events and entity name on which we have to register the Plug-in as given in the below screen shot.



• If the current project already has an existing plug-in assembly registered, you can also use the Add Plug-in shortcut menu option on the existing plug-in assembly and then select the entity you want it to apply to.

4. In the Create Plug-in dialog box, click OK to generate the plug-in code. This action also updates the RegisterFile.crmregister in the CRM Package project to store the plug-in registration information as given in the below screen shot.



5. Open the class that is generated and locate this comment // TODO: Implement your custom Plug-in business logic. Add your custom plug-in business logic to that method.

6. In the Properties of the plug-in project, on the Signing tab, select the Sign the assembly check box and set the strong name key file of your choice.

Deploying your solution

7. Right-click the CRM Package project and select Deploy as given in the below screen shot.



This builds the dependent projects and deploys the plug-in to the Microsoft Dynamics CRM server. any changes to the plug-in are reflected to the server during the build and deploy process.

8) The steps that we have added to the Plug-in gets added to the solution as given in the below screen shot. The Plug-in assembly on which you are currently working displayed in the Green colour.



9) When you click on the any component it will be opened from within the crm Explorer without having need it to open explicitly from browser as given in the below screen shot.

Double click on the entity and it will be opened in your solution itself in separate Tab as given in the below screen shot.



To Add a Step to a Plugin
1. Right-click a plug-in that is part of a plug-in assembly that is included in the current solution and select Add Step.
2. In the Create Plug-in dialog box, configure your step as given in the below screen shot.



Now CRM development made a lot easier.

Tuesday, November 1, 2011

Activity Feeds now available in Dynamics CRM 2011

Microsoft recently released Activity Feeds in its November update of Dynamics CRM Online 2011. These would however automatically be available to only those CRM organizations that one would subscribe to from this point on. For all existing organizations you need to download it from the pinpoint site http://dynamics.pinpoint.microsoft.com/en-IN/applications/microsoft-dynamics-crm-activity-feeds-12884926310

We installed this solution on CRM Online organization but I believe this can also be imported to an On-Premise organization.



It is quick to install and you can get it up and running in a matter of few minutes.




After you import the solution, you would find the following changes to your sitemap
A new option “What’s New” added to the Workplace.





Configuration options in Settings --> System





Lets first configure the entities to start receiving feeds from them.
You need to create a new Post configuration record through the Activity Feeds Configuration option. You need to create one record each for each entity that you want to setup for Activity Feeds.

In the entity name you need to enter the CRM entity logical name. So instead of Case, you would enter incident.




After you click on Save, you will find the Rules auto-created for this entity. I understand that these rules are predefined and there is no option to create a new rule. Also these rules are only available for certain entities. When I create a record for account entity, no rules were created for them.




For this configuration to take effect, you need to click on the All Customizations ribbon button. This will publish the entity customization for the set entity.






In our case, when we click on the All Customizations, it will modify the Case entity form to add the Record Wall.






If you have multiple forms designed for an entity, the publish fails.





You need to then manually add the tab for Record Wall. Instructions for these are provided here http://help.crm.dynamics.com/help/5.0.9688.1531/1033/LIVE/content/source_af_add_record_walls.htm
Once an entity is set up for activity feeds, you can then open any record for that particular entity and click on Follow to start receiving updates for that record.







Any updates to the record wall of the records that you choose to follow would be displayed to you on your Personal Wall.


With the auto-feed rules automatically created for the case entity, each time a new case is created or any of the actions on the case is performed that is being tracked by the activities feed, an update would automatically be posted for the Case on the its wall and would also be reflected on the wall of the users that follow that record.

You can also follow the feeds of another user. For this you need to open the User record and then click the follow button on the user record wall to start receiving updates posted by that user.



You are now set to collaborate in CRM on different CRM entities including custom entities!


To make the wall available on Custom entity you need to create a record in the Post configuration for the custom entity. In the entity name type the schema name of the custom entity and check the Enable walls checkbox.


Make sure you publish this custom entity after creating the configuration record.

Monday, October 31, 2011

Team Ownership now available in CRM 2011

In CRM, an entity could be designed to be User Owned or Organization owned. The User Owned ownership setting has now been changed in CRM 2011 to be User or Team Owned. This means that you can now assign a record to either a Team or an individual owner.

Let us now explore the behavior of records owned by a Team.

Using the Assign option you can now assign to a user or a Team.


Earlier you could only select a user.



In CRM 2011, you can define Teams and also assign Roles to the team. With each team, a Queue specific to the team is also created alongside.

The security role permission level has also been modified to accommodate the concept of Team. The user level permission now also extends to the team. This means that a user with user level permission can now work on records owned by themselves as well those that is owned by the team to which they belong.



The one that gives higher/maximum permission is applied to the user. Say a user does not have permission to invoice module. But the team to which they belong have the permission to Create/Read/Write user level invoice records, an Invoice assigned to the Team would be visible to the user.

All users of a team would have access to the record assigned to the Team.

With the concept of Team they have tried to reduce the need to Share the records. Earlier if you needed to provide another user access to a record owned by you, you had to share the record with them. Now if they are part of your team they have access to your records.

To explain technically, a new attribute Owning Team has now been added to each User/Team Owned entity. The OwningTeam will store the name of the Team if it has been assigned to a Team.



You can now programmatically assign Team to a record using the Assign Request. You can check here for the code. http://msdn.microsoft.com/en-us/library/gg327897.aspx

Tuesday, October 18, 2011

Enable Scripts on Bulk Edit form in CRM 2011

CRM 2011 includes the feature to enable script on the bulk edit form. By default the scripts are disabled for bulk edit forms.

To enable the script for Bulk edit forms check the below syntax

<event
active=["0" "1" "true" "false"]
application=["0" "1" "true" "false"]
attribute="String"
BehaviorInBulkEditForm="String"
eventType=["DataEvent" "ControlEvent"]
name="String">
<dependencies />
<Handlers />
<InternalHandlers />
</event>

See below detailed descriptions for the attributes.




Steps to enable the script on bulk edit form:
- Include the entity for which you would like to enable the bulk edit script and export the solution.
- Open the customization.xml
- Add BehaviorInBulkEditForm="Enabled" to the event handlers as shown below


<event name="onload" application="false" active="false" BehaviorInBulkEditForm="Enabled" >
<event name="onsave" application="false" active="false" BehaviorInBulkEditForm="Enabled" >

- Save and Import the solution, publish it.
- Now your script will work on bulk edit form.

This way you can let your users use bulk edit freely with your custom script also executing just fine. Earlier, usually if there was custom business logic to be performed plugins were advised as it would allow the custom business logic to be executed for all records that were edited through Bulk Edit.

Friday, October 14, 2011

Different operators used with workflow

There are six different operators used in e workflow.

1. Set to: This operator is used to set value of the field of any data type.



2. Append with: This operator can only be used with text field. It will append specified field's value or the default value to the existing value. This operator has introduced in CRM 5.







3. Clear: This operator can be used with all data types. This will clear the field's value.



4. Increment by: This operator can only be used with decimal fields. This will increment the existing value with the specified field's value or default value.
5. Decrement by: This operator can only be used with decimal fields. This will decrement the existing value with the specified field's value or default value.
6. Multiply by: This operator can only be used with decimal fields. This will multiply the existing value with the specified field's value or default value.



Bulk or Mass edit is the great feature in CRM that allows us to edit multiple records at a time. But it will only allows us to set the value, we cannot perform above operations in bulk edit. With the help of workflows, we can perform above operations on multiple records.