Showing posts with label CRM 4.0. Show all posts
Showing posts with label CRM 4.0. Show all posts

Saturday, February 19, 2011

Difference between CRM 4.0 and CRM2011 script for using on form customization

When working with CRM2011 Java script we found many difference about syntax/methods between CRM2011 and CRM4.0 Please check some of the comparisions we have listed. Please click on the Image below to enlarge view.

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.

Friday, October 22, 2010

Issues with class level declaration in CRM 4 Plugins and Workflows

It is important that you avoid class level declaration and initialization of variables in Plugins and Workflows.

Let us discuss the issues that one can face with Plugins. Plugins as you know is executed synchronously. But if there happen to be multiple calls made to the same plugin assembly and class, a new object for the Plugin is not always created. Instead the same object is reused. So if you have initialized a class level variable at the start and not in the Execute method, it will be initialized only once at the start and there after for subsequent calls the plugin will reuse the last value stored in the variables much like the static variables.

An example of this would be

public class MyPlugIn : IPlugin
   {
      ICrmService _service = null;
      Bool _myBool = false;

public void Execute(IPluginExecutionContext context)
   {
       //Check if particular field contains data then set the _myBool as true
   {
       _myBool = true;
   }
      //Update record with _myBool Field.
   }
   }

_mybool is initialized to be false only once at the start. If for some execution the condition succeeds and the value is set to true. The next call to this plugin would use the _mybool value as true by default not initialize it to false.

This behavior can be replicated using the Bulk Edit feature of Dynamics CRM. If you have a plugin registered for the Update method and you use the Bulk Edit feature to update multiple records at one go, the plugin would fire for each of the records modified but the _mybool variable will only be initialized once.

It would be advisable to ensure that class level variables are initialized in the Execute method each time.

Workflow Issues:

If you happen to declare the ICrmService variable at class level in a workflow assembly and make a call to that assembly in step 1 of the workflow and have step 2 that performs another action in the same workflow, the workflow would go into Waiting and not close with a completed or failed status.

The Workflow error message will display the following error for the Workflow job.

Workflow paused due to error: Unhandled Exception: System.Workflow.Runtime.Hosting.PersistenceException: Type 'Inogic' in Assembly 'Inogic, Version=1.0.0.0, Culture=neutral, PublicKeyToken=null' is not marked as serializable. at System.Workflow.Runtime.WorkflowExecutor.Persist(Activity dynamicActivity, Boolean unlock, Boolean needsCompensation) at System.Workflow.Runtime.WorkflowExecutor.System.Workflow.ComponentModel.IWorkflowCoreRuntime.PersistInstanceState(Activity activity) at System.Workflow.ComponentModel.Activity.MarkClosed() at System.Workflow.ComponentModel.Activity.MarkCompleted() at System.Workflow.ComponentModel.ActivityExecutionContext.CloseActivity() at System.Workflow.ComponentModel.ActivityExecutorOperation.Run(IWorkflowCoreRuntime workflowCoreRuntime) at System.Workflow.Runtime.Scheduler.Run() Inner Exception: System.Runtime.Serialization.SerializationException: Type 'Inogic' in Assembly 'Inogic, Version=1.0.0.0, Culture=neutral, PublicKeyToken=null' is not marked as serializable. at System.Runtime.Serialization.FormatterServices.InternalGetSerializableMembers(RuntimeType type) at System.Runtime.Serialization.FormatterServices.GetSerializableMembers(Type type, StreamingContext context) at System.Runtime.Serialization.Formatters.Binary.WriteObjectInfo.InitMemberInfo() at System.Runtime.Serialization.Formatters.Binary.WriteObjectInfo.InitSerialize(Object obj, ISurrogateSelector surrogateSelector, StreamingContext context, SerObjectInfoInit serObjectInfoInit, IFormatterConverter converter, ObjectWriter objectWriter) at System.Runtime.Serialization.Formatters.Binary.WriteObjectInfo.Serialize(Object obj, ISurrogateSelector surrogateSelector, StreamingContext context, SerObjectInfoInit serObjectInfoInit, IFormatterConverter converter, ObjectWriter objectWriter) at System.Runtime.Serialization.Formatters.Binary.ObjectWriter.Serialize(Object graph, Header[] inHeaders, __BinaryWriter serWriter, Boolean fCheck) at System.Runtime.Serialization.Formatters.Binary.BinaryFormatter.Serialize(Stream serializationStream, Object graph, Header[] headers, Boolean fCheck) at System.Runtime.Serialization.Formatters.Binary.BinaryFormatter.Serialize(Stream serializationStream, Object graph) at System.Workflow.ComponentModel.Activity.Save(Stream stream, IFormatter formatter) at System.Workflow.ComponentModel.Activity.Save(Stream stream) at System.Workflow.Runtime.Hosting.WorkflowPersistenceService.GetDefaultSerializedForm(Activity activity) at Microsoft.Crm.Workflow.CrmWorkflowPersistenceService.SaveWorkflowInstanceState(Activity rootActivity, Boolean unlock) at System.Workflow.Runtime.WorkflowExecutor.Persist(Activity dynamicActivity, Boolean unlock, Boolean needsCompensation)

This is again because of the declaration of the CRM service object at the class level. The variable is not released after the completion of job if the variable is defined at class level and hence conflicts with the steps that follow in the same workflow job.

[CrmWorkflowActivity("Customer Search")]
Public partial class CustomerSearch: Activity
{
public static ICrmService crmservice = null; // or make it as function level reference
…… Execute(…….) { }
………..
}

Moving the ICrmService object declaration from Class level to the Execute method ensure that the object is released upon the completion of the job.

protected override ActivityExecutionStatus Execute(ActivityExecutionContext executionContext)
{
ICrmService crmservice = null;
Processing…..
}

hopefully this solution will help you to avoid custom WF error. Any feedback on this blog is commendable.