Wednesday, May 21, 2014

CRM - Handling Plugin Messages

In CRM when creating we will be handling multiple messages. I am trying to put different approaches we have to take based on messages in a single place. 


  • Update

if (context.InputParameters.Contains("Target") && context.InputParameters["Target"] is Entity)
Entity entity = (Entity)context.InputParameters["Target"];

  • Associate/Disassociate

if (context.InputParameters.Contains("Target") && context.InputParameters["Target"] is EntityReference)
EntityReference entityReference = (EntityReference)context.InputParameters["Target"];
if (context.InputParameters.Contains("Relationship"))
{
string relationshipName = context.InputParameters["Relationship"].ToString();
if (relationshipName == "relationshipnametocheck")
{}}}

   Reference.                     

  • SetState/SetStateDynamicEntity

if (context.InputParameters.Contains("EntityMoniker") && context.InputParameters["EntityMoniker"] is EntityReference)
EntityReference entityReference = (EntityReference)context.InputParameters["EntityMoniker"];

If we have to trigger a plugin when a record status changes, its advisable to register the same for both tthe SetState and SetStateDynamicEntity. The reason why both the messages are required is both messages perform the same action in CRM and as there is not thumb rule for which action which message is fired, its better to register the plugin for both messages so that our plugin works properly. Reference.

Friday, May 9, 2014

CRM - Creating an email using REST endpoints

As a CRM developer everyone of us will undergo a scenario where now or tomorrow we may have to create an email record using REST endpoint. Its pretty easy that we can use any one of the REST approach and do that. But the challenge here is that REST endpoint does not support the party list. Because of this we cannot assign them to the email record which we create.

Solution for this is to create an activity (email) first and then create the a party list entity and link that to the created activity. To see how to do that we can refer to this simple but effective blog from "MS CRM Shop". 

Thanks team for this nice blog. 

Hope this helps !!!

Monday, May 5, 2014

CRM 2013 - Include Middle Name in contact's flyout control

By default, the contact's full name is populated as fly out control in CRM 2013. This will get reflected once the user enters the data and clicks on "Done" button.

The fly out control for the contact is based on the system settings. So if we need to make any changes to the fly out anchor the only way to do this right now is to change the system settings accordingly.

For example, by default the full name is set to have only first name and last name. If we need to have the middle name in the fly out control, include the middle name also in the contact name format under system settings.

For a detailed blog on this same subject please find it here.

Thanks Frank for such a nice blog. 




CRM 2013 - Composite Fields an overview

While trying to understand more on the composite control was able to see a blog in Community forums regarding the same. 

Thanks to the author for such a nice blog. 

Please read the same here.

Hope this help!!!


Configuration for CRM Plugins

CRM plugins are always great feature where we can automate many functionality which we cannot automate from user interface. But almost eve...