Monday, January 17, 2011

Use Tracing in CRM 2011 Plugins

CRM SDK provides way for you to include the debug details about your plug-in in case you need to trace the plug-in execution. For this you will have to initialize the “ITracingService”. The service provides way to trace the details and display it whenever plug-in fails and throws an exception.

//Initialize the service
ITracingService tracingService = (ITracingService)serviceProvider.GetService(typeof(ITracingService));

Once initialized, you just need to add the logical and meaningful details as per your logic using below code,
tracingService.Trace(yourMessage);

Shown below is the example of message shown to the user when plug-in fails and throws exception.


Hope this helps you how to use Tracing in CRM 2011 plugins!

Wednesday, January 12, 2011

Connections Role in CRM 2011

CRM 4.0 provided the ability to define the relationship between entities using the Relationship feature. However this was only available for defining relations between Account, Contact and Opportunity. This concept has been enhanced further with the introduction of Connections in CRM 2011. Moreover, this has now been extended to include any entities including custom entities that you define.

Connections can basically be used to define the relation or the association between two entities. To give an example you can have an account with multiple contacts. With the help of connection you can define that one of the contact is actually the partner in the company and another an employee.

One can define any number labels for the relationships Like:

Family relationships (father, sister, brother, spouse/partner, cousin)
Social relationships (tennis partner, golf partner, club member, friend)
Sales relationships (champion, influencer, stakeholder, referrer, gatekeeper)
Business relationships (supplier, partner, consultant, contractor, competitor, former employer)

When you create a connection role, you can select the CRM entities for which this connection role can be used. In the below example we have created a role called “Employer” and made it available to be associated with the Account entity.


After users choose the records that will participate in the relationship, they can select from available labels in the respective relationship form. Only valid labels based on the definition of the entity types in the relationship role are displayed.

Managing Relationship roles is the task of choosing the labels that will represent valid options when users define these types of relationships. When you define the labels, you also define which combination of account, contact, or opportunity records will be valid for the label. Setting consistent relationship roles allows users to select meaningful labels for the relationship roles they set that can be used in a report or an Advanced Find query.

Users are not required to choose labels when they set relationships. They can just enter a description in the relationship.

To enable the Connections Role on any entity we need to permit to create connection at the entity level. As shown in the below screenshot.


Once Connections is enabled for an entity it cannot be disabled.

How to Create Connections for the Related records in the CRM 2011:

To Create the connection Open an account and go to Connections and click on the Connect  To Another. As shown in the below screenshot.

In the following window you can enter the related entity along with the role that needs to be associated.

You can see this same connection on the related record as well as shown below.


Hope this helps!

Friday, January 7, 2011

Sales Area Enhancements in CRM 2011

There have been considerable improvements in the functionality being offered in the Sales Area in CRM 2011.

Changes have been incorporated in the area of Opportunities, Orders and Invoices

CRM 4.0 Opportunities did not support adding of Write-In Products or Price Override. These attributes were present in the Opportunity entity in CRM 4.0 but not included on the forms. Even if you added them manually on the form, the functionality didn’t work. Here is a screenshot of the Opportunity Product in CRM 4.0



A major drawback was you could not create opportunities for write-in products.

But in the CRM 2011 the functionality of both Price Override and Product Override (Write-in Product) has been included.



Another change brought about in CRM 2011 is ability to enter negative quantity or amounts to create Negative Quotes/Orders/Invoices. This was sorely missed in CRM 4.0 when it came to being able to record Sales returns or Credit Memos.

In the below screenshot we added two products against the quote and it’s allow us to save it . One with write-in product with a negative Price Per Unit and another one is existing product which has negative Quantity assigned. This information flows down from Opportunity --> Quote --> Order --> Invoice as well.



As shown in below screen shot the totals are also updated on Quote header with amounts fields.



Note: You can’t set both the Price and Quantity to negative values when creating the line item otherwise it will display the following error to the user. You can set either the Quantity or Price Per Unit to negative value but not both.



With the inclusion of Negative orders and Invoices, Microsoft has tried to include a bit of accounting functionality to support recording of returns and credits. Payments is still something that has not been included in Sales Area. Yes it is CRM and not ERP but if it could go ahead and support Negative Sales, it would help if custom entity for Payments was included as well.

May be the next version :)

Tuesday, January 4, 2011

CRM 4 to CRM 2011 Upgrade.

Recently we tried to upgrade a highly customized CRM 4 install to CRM 2011 and thought it would be worthwhile to list out our findings for the benefit for all.

CRM 2011 supports both in-place upgrade as well as a fresh CRM 2011 install with a later CRM 4.0 organization import into CRM 2011. We attempted the second way, that a fresh install of CRM 2011 and then tried to import the customized organization of CRM 4.0.

If you install the CRM 2011 beta copy and try the import you will receive the following error.

…lead.Address1 Country length 160 more than original value 100…

This appears to be a bug of the beta version that is probably rectified in the CRM 2011 RC released recently.

After a successful install, you can try to import the CRM 4.0 organization, it auto detects that it is an upgrade and would performs all the necessary operations on the database. Make sure you have another backup of the CRM 4.0 in case the upgrade fails mid-way you will need to go back and restore the original copy and start over again.

After a successful upgrade we found the following items we auto-upgraded to CRM 2011 standards by the upgrade tool.

Scripts:

All the scripts written on form save, load and Change will be automatically converted into web Resource and saved as Library with the name Entityname_main .see the display name below.
Select any Web Resource it looks as shown below.


On click of Form properties for any entity you will find that library is already added on the form and it is called on load event with function name.


The code written on the Load event would be put into a function named Form_onload. The OnSave event is changed to function named Form_onsave and Onchange becomes
Attributename_onchange.

Images:

All the Images used in the Custom entities will be saved as Web resource.

ISV buttons:

Any script written on custom button added through ISV in CRM will be converted to Application Ribbons. Buttons of CRM 4.0 are moved to Ribbons in CRM 2011 as shown below.

Plugins:

Plug-in registered in the CRM for entities will be saved as Plug –In Assemblies and Sdk Message Processing

Plug –In Assemblies shows Name ,Version, Culture Public Key Token and the date on which it was created and last modified date.

Sdk Message Processing shows Message, Event Handler, object type code ,Stage and Status

Workflow:

The Workflows would be auto-upgraded as Processes in CRM 2011 as can be seen from the screenshot below


Form Layout

The form layout is carried over as is during the upgrade from CRM 4.0 to CRM 2011. We however found a conflicts tab added to a couple of forms but were unable to trace the controls placed in this section to any of the controls in the original CRM 4 form.

There are sure to be many more items that were upgraded behind the scenes and we will update the list in times to come. However this is a pretty good reference point to start with for a CRM 4 to 2011 upgrade.

Tuesday, November 30, 2010

Workflows - Behind the scene

We were recently working on designing a tool that deletes workflow job. We thought it would be easy to just filter out all job that related to a workflow by the workflow id and then delete that’s it.

But like always we were in for a surprise. Just thought putting it down would help others in resolving this mystery.

Each Workflow has a unique id just like any other entity. But if you search for workflow jobs using this id to look for all jobs related to this workflow, you would be in for a surprise. It would not return all of the jobs that you are expecting. The reason being each time you revise a workflow i.e unpublish and publish the workflow once again, it creates a new workflow entry in the tables. If you want to look for the workflow jobs related to a particular workflow then you need to look for the workflow id assigned to each of its versions.

For workflow, you would find the following definitions available in the tables.


There will be only 1 definition record in CRM for a workflow no matter how many times you revise it.


But each time you publish a workflow it will create a new activation record.


The activation workflow record will have its parent workflowid set to the workflow definition id.

The workflow definition record will store the id of the currently active version of the workflow.

If you unpublish a worklfow and publish it again, it will add another row to the table and the status would now be as follows:


Note the activeworkflowid of the Definition record now refers the Guid of the latest version of the workflow that is published.

Now if you want to look for system jobs for this workflow, you will need to search for jobs that have their workflowactivationid set to any of the workflowid listed above in the table.

Hope this helps you find your way through the maze of workflows!!!