Posts Tagged ‘plug-ins’

Scribe Plugin Publisher for Microsoft Dynamics CRM – system jobs failing in MSCRM

Friday, January 15th, 2010

Using the Scribe “Dynamics GP to Dynamics CRM” template, I was getting system jobs failed when updating or creating records in CRM. After lots of testing and trying I read something about permission in message queue. I went in the message queue for:

  • {server}\private$\{orgName}@{server}_mscrmpubfailed
  • {server}\private$\{orgName}@{server}_mscrmpubin
  • {server}\private$\{orgName}@{server}_mscrmpubsucceeded

I adjust the security for “Everyone” on the queues to “Full Control”. Updated an account in MSCRM and the system jobs then succeeded. I think you might be able to adjust the setting so it not “Full Control” for sure the plug-in needs to be able to send a message to the mscrmPubIn queue.

Retrieving Pre and Post data in MSCRM Plug-ins (Create, Update and Delete)

Tuesday, January 12th, 2010

 

When you look at the sample of plug-in in the SDK they all use the InputParameters property bag. The InputParameters property bag contains all the information specified in the Request class whose message caused the plug-in to execute. As the request class does not include the pre and post data of the entity, the InputParameters property does not contain the pre and post data. The InputParameters property does contain a “Target” property which is a Dynamic Entity of the data that was changed in your entity. Note: The target Dynamic Entity only has the properties (fields) that where changed.

To get the pre and post date of an Entity in a plug-in you need to use the context.PreEntityImages and context.PostEntityImages property bags. You will also need to add an image. In the image you give it an alias and indicate if it is pre and/or post and also define what attributes (fields) you need.

If you don’t know or the fields could change leave the attributes as all fields. If you only need a few fields everything should run faster if you just indicate the fields you need. Now to get a pre DynamicEntity in your plug-in you use context.PreEntityImages.Properties["image alias"]. Note in the following code I first check that the PreEntityImages.Properties contains the “image alias” and the the property is a DynamicEntity.

 

DynamicEntity preSaveEntity;

DynamicEntity postSaveEntity;

if (context.PreEntityImages.Properties.Contains(“icrmAddress”) && context.PreEntityImages.Properties["icrmAddress"] is
DynamicEntity)

{

preSaveEntity = (DynamicEntity)context.PreEntityImages.Properties["icrmAddress"];

}


if (context.PostEntityImages.Properties.Contains(“icrmAddress”) && context.PostEntityImages.Properties["icrmAddress"] is
DynamicEntity)

{

postSaveEntity = (DynamicEntity)context.PostEntityImages.Properties["icrmAddress"];

}

 

You are not always going to have a pre and post data it will depend on the Message(Create, Update, Delete, etc) and the Eventing Pipeline Stage of Execution (Pre Stage or Post Stage).

Need a custom MSCRM Plug-in created contact iCRM at http://www.icrm.ca or through.

I used CRM Plugin Registration Tool 2.2


© 2009-2010 iCRM Blog All Rights Reserved -- Copyright notice by Blog Copyright