Monday, November 19, 2012
Sending an Email using CRM 2011
http://rajeevpentyala.wordpress.com/2011/08/03/sending-an-email-using-crm-2011-plug-in/
Wednesday, November 14, 2012
Different Plugin CRM 4 and CRM 2011
1) References
We no longer use the
Microsoft.Crm.* DLLs, as the namespace had a complete makeover. MS CRM 2011
introduced a brand new namespace “XRM”, hence the DLLs to use are
Microsoft.Xrm.*
Since the changes in MS CRM 2011
SDK are using WCF based services (compared to the web services used by its
predecessor), we must reference the below mentioned:
o System.ServiceModel
o
System.Runtime.Serialization
A reference to the
“Microsoft.IdentityModel” DLL is a must if the plugin is targeted at MS CRM
2011 online version.
2) Executing
Execute method now uses
IServiceProvider.
|
CRM 4.0
|
CRM 2011
|
public void
Execute(IPluginExecutionContext context)
|
public void
Execute(IServiceProvider serviceProvider)
|
3) IPluginExecutionContext
Similar to the “Execute” method
retrieving the context object inside a plugin also changed:
IPluginExecutionContext context =
(IPluginExecutionContext)serviceProvider.GetService(typeof(IPluginExecutionContext));
4) CRM Service
In CRM 2011,
ICrmService is replaced by IOrganizationService
5) DynamicEntity has
been changed to Entity
Similarly “Properties” of a CRM
entity now have to be accessed using the “Attribute” collection:
entity.Attributes.Contains("new_incidentnumber")
|
Below given template can be used to
create a plugin for the MS CRM 2011
using System; using System.ServiceModel; using System.Runtime.Serialization; using Microsoft.Xrm.Sdk; using Microsoft.Xrm.Sdk.Query; using Microsoft.Xrm.Sdk.Messages;
namespace MyPlugin
{ public class MyPlugin : IPlugin { public void Execute(IServiceProvider serviceProvider) { IPluginExecutionContext context = (IPluginExecutionContext)serviceProvider.GetService(typeof(IPluginExecutionContext)); if (context.InputParameters.Contains("Target") && context.InputParameters["Target"] is Entity) { Entity entity = (Entity)context.InputParameters["Target"]; if (entity.LogicalName != "entity logical name”) { return; } try { IOrganizationServiceFactory factory = (IOrganizationServiceFactory)serviceProvider.GetService(typeof(IOrganizationServiceFactory)); IOrganizationService service = factory.CreateOrganizationService(context.UserId); //Plugin Code } catch (FaultException ex) { throw new InvalidPluginExecutionException("An error occurred in the plug-in.", ex); } } } } } |
Queues in MS CRM
There are a lot of misconceptions about queues. They only apply to cases and activities. While the terminology is the same, assigning a case or activity to a queue is not the same as assigning an entity to a CRM user or team. Programmatically what is being used is a RouteRequest rather than anAssignRequest.
To get a better idea how this works we'll look at database. There are two entities storing queue information, the Queue and the QueueItem. These are not customizable.
Queue – (table) contains all queues
- There are two queues automatically created for each CRM user.
- Assigned
- In Progress
- Any user defined queues that you create are also stored here.
- example: My New Public Queue
QueueItem – (link table) Contains an entry for each entity assigned to a queue.
- An item can only belong to one Queue at a time,
- The only entities that can below to a Queue are:
- Activities ( email, tasks, etc. )
- Cases
reference :
http://crmscape.blogspot.com/2008_11_01_archive.html
- Assigned
- In Progress
- example: My New Public Queue
- Activities ( email, tasks, etc. )
- Cases
Monday, November 12, 2012
Assigning value and type mapping between dynamics crm versions
Assigning value and type mapping between dynamics crm versions
Type Mapping Between Versions
The following table shows the mapping between the defined type for an entity attribute, the type that is used in a record, and the type that was used in Microsoft Dynamics CRM 4.0.
| AttributeTypeCode | Microsoft Dynamics CRM 2011 type | Microsoft Dynamics CRM 4.0 type |
|---|---|---|
| AttributeTypeCode.BigInt | long | N/A |
| AttributeTypeCode.Boolean | bool | CrmBoolean |
| AttributeType.CalendarRules |
EntityCollection or CalendarRules[]
| DynamicEntity[] or calendarrule[] |
| AttributeType.Customer | EntityReference | Customer |
| AttributeType.DateTime | System.DateTime | CrmDateTime |
| AttributeType.Decimal | decimal | CrmDecimal |
| AttributeType.Double | double | CrmFloat |
| AttributeType.EntityName | string | Attributes with ObjectTypeCode inDisplayMask |
| AttributeType.Integer | int | CrmNumber |
| AttributeType.Lookup | EntityReference | Lookup |
| AttributeType.ManagedProperty | BooleanManagedProperty | N/A |
| AttributeType.Memo | string | System.String |
| AttributeType.Money | Money | CrmMoney |
| AttributeType.Owner | EntityReference | Owner |
| AttributeType.PartyList | EntityCollection or ActivityParty[] | activityparty[] or DynamicEntity [] |
| AttributeType.Picklist | OptionSetValue | Picklist |
| AttributeType. Uniqueidentifier(Formerly PrimaryKey) | System.Guid | Key |
| AttributeType.String | string | System.String |
| AttributeType.State | OptionSetValue or enumeration generated for the entity state | EntityNameStateInfo |
| AttributeType.Status | OptionSetValue | Status |
| AttributeType.Uniqueidentifier | System.Guid | UniqueIdentifier |
| AttributeType.Virtual | Not used in records. | Not used in records. |
refrence : http://community.dynamics.com/product/crm/crmtechnical/b/isvlabs/archive/2011/03/05/assigning-value-and-type-mapping-between-dynamics-crm-versions.aspx
How to get entity instance id in CRM 4.0 plugin for each message type
this post you can get instance id in CRM:
Guid instanceID = new Guid(context.OutputParameters.Properties["id"].ToString());
Massage name “Update”:
Guid instanceID = (Guid)((Microsoft.Crm.Sdk.Key)((Microsoft.Crm.Sdk.DynamicEntity)context.InputParameters.Properties["Target"]).Properties[context.PrimaryEntityName + "id"]).Value;
Massage name “SetState”:
Guid instanceID = new Guid(context.OutputParameters.Properties["id"].ToString());
Massage name “Assign”:
Guid instanceID = vInstanceID = (Guid)((Microsoft.Crm.Sdk.Moniker)context.InputParameters.Properties["Target"]).Id;
Massage name “Delete”:
instanceID = ((Microsoft.Crm.Sdk.Moniker)context.InputParameters.Properties["Target"]).Id;
Massage name “Close”:
Guid instanceID = ((Microsoft.Crm.Sdk.Lookup)((Microsoft.Crm.Sdk.DynamicEntity)context.InputParameters.Properties["IncidentResolution"]).Properties[context.PrimaryEntityName + "id"]).Value;
Massage name “Route”:
Guid instanceID = ((Microsoft.Crm.Sdk.Moniker)context.InputParameters.Properties["Target"]).Id;
Massage name “SetStateDynamicEntity”:
Guid instanceID = ((Microsoft.Crm.Sdk.Moniker)context.InputParameters.Properties["EntityMoniker"]).Id;
reference : http://rami-heleg.blogspot.com/2009/12/how-to-go-get-entity-instance-id-in-crm.html
Upgrading a CRM 4.0 Custom Workflow Activity to CRM 2011
this link is very useful for upgrading but you can't solve any problems. it is very generally for upgrading.
http://blogs.msdn.com/b/crm/archive/2010/11/17/upgrading-a-crm-4-0-custom-workflow-activity-to-crm-2011.aspx
http://blogs.msdn.com/b/crm/archive/2010/11/17/upgrading-a-crm-4-0-custom-workflow-activity-to-crm-2011.aspx
Monday, November 5, 2012
How to re-size columns in CRM 4 + javascript
Hi
i didn't find any way to resiza a column on the internet but i can find a way with javascript that resize a column.
you can use this function in your class in javascript code and resize your column , that's it.
//this function set width for a field
//"object" argument is an object that is a field and "width" argument can be percentage or pixel and its type is String
CommonClass.prototype.SetWidthField = function (object, width) {
//we ensure that object style doesn't change so we save on "oldStyle"
var oldStyle = object.style.cssText;
//concat old style with new attribute (width)
object.style.cssText = oldStyle + ';' + 'width:' + width + ' !important';
}
sincerely
S.Amir S.Hosseini
i didn't find any way to resiza a column on the internet but i can find a way with javascript that resize a column.
you can use this function in your class in javascript code and resize your column , that's it.
//this function set width for a field
//"object" argument is an object that is a field and "width" argument can be percentage or pixel and its type is String
CommonClass.prototype.SetWidthField = function (object, width) {
//we ensure that object style doesn't change so we save on "oldStyle"
var oldStyle = object.style.cssText;
//concat old style with new attribute (width)
object.style.cssText = oldStyle + ';' + 'width:' + width + ' !important';
}
sincerely
S.Amir S.Hosseini
What is this blog about?
Hello and welcome to the first entry onto my new blog.
The first question is what is this blog going to be about. A very good question and I’m glad you ask it is going to be about
The first question is what is this blog going to be about. A very good question and I’m glad you ask it is going to be about
· Microsoft Dynamics CRM 4
· Microsoft Dynamics CRM 4 Applications Certification
· Business Intelligence
· Business Objects
· Business in general
· Interesting things I find on the internet
· Interesting things which happen to me at work
I hope anyone who stumbles upon this blog will enjoy reading
it and contribute with some comments.
so does the world need another CRM blog, yes of course it does because this blog is going to be interesting, amusing and will help you learn about CRM, business intelligence and business through ideas, my research and my experiences.
This blog will also be useful for people studying for the Microsoft Dynamics CRM Applications certification because I am going to talk about any links I find useful and put my notes down on subjects which are featured in the exam. This helps the information stick in my head because to explain something to somebody means you have to understand it.
so does the world need another CRM blog, yes of course it does because this blog is going to be interesting, amusing and will help you learn about CRM, business intelligence and business through ideas, my research and my experiences.
This blog will also be useful for people studying for the Microsoft Dynamics CRM Applications certification because I am going to talk about any links I find useful and put my notes down on subjects which are featured in the exam. This helps the information stick in my head because to explain something to somebody means you have to understand it.
Subscribe to:
Comments (Atom)