Thursday, February 5, 2015

Microsoft CRM publisher stuck on “Initializing” in Scribe Insight

If you are trying to create a CRM publisher in Scribe Insight and it is stuck on “Initializing” as shown in the screen shot below:
It means that there is something wrong.


If you check in the event viewer, you may find the following error:
An unexpected error occurred.
Microsoft Dynamics CRM Publisher
Error setting publisher settings: System.Messaging.MessageQueueException (0x80004005): Invalid queue path name.
   at System.Messaging.MessageQueue.ResolveFormatNameFromQueuePath(String queuePath, Boolean throwException)
   at System.Messaging.MessageQueue.Exists(String path)
   at Scribe.AdapterBase.Publisher.QueueService.InitPublisherQueues(String pubInQueueName, String pubSucceededQueueName, String pubFailedQueueName)
   at Scribe.AdapterBase.Publisher.ScribePubWorkerBase.InitPublisherQueues()
   at Scribe.AdapterBase.Publisher.ScribePubWorkerBase.setSettings(String settingsXML, String entitiesXML, Object lastRunTime, Object lastRunTimeUTC)
The error suggests that there is problem with the path of the queue


Compare the queue names in the CRM publisher and message queues in component services as shown in the following screen shots.
image image
If the queue names are different then we have to update the queue names in the internal database.
Note: I don’t know if this is a supported solution.
  1. Backup your ScribeInternal database.
  2. Look into the scribe.bridges table and find the bridgeid of your CRM publisher. All the publisher settings including the queues are stored in the settings column.
  3. Now update the settings column with the proper queue paths.
Note: Settings column stores the data as XML. Please be careful when updating the column.

Wednesday, January 28, 2015

'Security Negotiation Exception' during plug-in execution in CRM2013

A few months ago, we experienced an issue during a plugin execution in the dev. environment. We were using Scribe Insight for integration. We were using the “Microsoft Dynamics CRM publisher” for scribe that registered a plugin on the contact entity. Everything was working perfectly until we received the following error:

Unhandled Exception: System.ServiceModel.FaultException`1[[Microsoft.Xrm.Sdk.OrganizationServiceFault, Microsoft.Xrm.Sdk, Version=, Culture=neutral, PublicKeyToken=31bf3856ad364e35]]: The following error has occurred in the Scribe Change History plug-in: System.ServiceModel.Security.SecurityNegotiationException: Microsoft Dynamics CRM has experienced an error. Reference number for administrators or support: #0CCC3255  


During troubleshooting we found the following entry in the event viewer of the backend server. 

The Kerberos client received a KRB_AP_ERR_MODIFIED error from the server serviceaccountname. The target name used was HTTP/CRMFrontEndServer. This indicates that the target server failed to decrypt the ticket provided by the client. This can occur when the target server principal name (SPN) is registered on an account other than the account the target service is using. Ensure that the target SPN is only registered on the account used by the server. This error can also happen if the target service account password is different than what is configured on the Kerberos Key Distribution Center for that target service. Ensure that the service on the server and the KDC are both configured to use the same password. If the server name is not fully qualified, and the target domain (DomainName) is different from the client domain (DomainName), check if there are identically named server accounts in these two domains, or use the fully-qualified name to identify the server 

The “EventSourceName” was Kerberos.

Looking at the error we hypothesised that there was an SPN issue for the CRMFrontEndServer server.

You can receive this error for any plugin published in the sandbox. It will only happen if the sandbox service is not installed on the same server as CRM web site and kerberos authentication is enabled for the website.


We used the following account to list all the SPNs registered for the serviceaccountname.
setspn –l domain\serviceaccountname

The command displays only the SPN registered on the HTTP/  (Fully Qualified domain name of the CRM front end server).

We added a new SPN on the servername using the following command setspn –a http/CRMFrontEndServer domain\serviceaccountname That was it. We restarted the sandbox service and the error was gone.

For more information on SPNs and their configuration you can check out this KB article from Microsoft. 

Wednesday, December 3, 2014

Strange behaviour of the two options(Boolean) field in CRM2013

Last week, I came across a strange behaviour of the two options field in CRM2013. I am not sure if it is a bug or it is by design.


I have a boolean field on an entity. This field is not added to the form. The default value of the field is set to false. When a new record is created in CRM, the integration process copies the record into the external system and updates the boolean field to true in the CRM. This boolean field indicates if the record is copied to the external system or not.

It works perfectly expect in the following scenario.

If the user updates the  record immediately after creating the record without closing the form, CRM will reset the value of the boolean field back to false. According to me, it is a bug. CRM should not pass the un modified fields to the save method.

The following screen shot displays the audit history of the field.



Add the field to the form.

Monday, November 24, 2014

InitializeFromRequest in CRM2013

InitializeFromRequest may be the least used request in the Dynamics CRM. It is available since CRM 4.0. I was talking to some of the guys in my team and most of them have never used this request. It initiates an instance of an entity from an existing entity.

It can be used when there is a 1:N relationship between the entities. It is equivalent of creating a child record from the parent form.

For example there is a 1:N relationship between account and contact. if you create a contact from the contact subgrid from the account form, it will prefill the parentcustomer field and all the fields defined in the relationship mappings.

The following screen shot displays the mappings of 1:N relationship between account and contact.
The same functionality can be achieved using InitializeFromRequest. This request returns a InitializeFromResponse. The request does not create a new record but the response can be used to create a new record.
Here is the code.
    // Create the request object
     InitializeFromRequest initialize = new InitializeFromRequest();

     // Set the properties of the request object
     initialize.TargetEntityName = "contact";

     // Create the EntityMoniker
     initialize.EntityMoniker = new EntityReference("account", new Guid("8A5D8108-DE3B-E311-9401-00155D1B7B00"));
     // fields to initialised from parent entity
     initialize.TargetFieldType = TargetFieldType.All;

     // Execute the request
     InitializeFromResponse initialized =

     if (initialized.Entity != null)
         //get entity from the response
         Entity entity = initialized.Entity;

         // set the name for the contact
         entity.Attributes.Add("firstname", "John");
         entity.Attributes.Add("lastname", "Smith");

         //create a new contact

Happy coding..

Saturday, August 9, 2014

Setup and Deployment guide for ‘Performance Toolkit’ for Dynamics CRM 2011

Performance Toolkit for Microsoft Dynamics CRM 2011 is available on ‘Microsoft Pinpoint’. But the hyperlink for ‘setup and deployment’ guide is not working. It always displays the following message.
service unavailable 

I have found an old copy of the guide. You can download the guide from here.


Friday, December 6, 2013

“Run Report” button on custom entities forms

In CRM2013 the “Run Report” button is missing on custom entities. The button is not available even if you have selected display in the “Forms of the related record types”. The problem is the “Display Rule” named “Mscrm.HideOnCommandBar” associated with the “Run Report” button. It is a default behaviour for custom entities.

There are 2 different ways to display the “Run Report” button on the custom entities.

By adding the "CommandDefinition” to the ribbon definition of the entity.

  1. Create a new solution in CRM, add contact entity to the solution and export the solution.
  2. Open the customization file from the exported solution and look for <RibbonDiffXML> . It will look like the following XML.
  3. <RibbonDiffXml>
      <CustomActions />
        <RibbonTemplates Id="Mscrm.Templates"></RibbonTemplates>
      <CommandDefinitions />
        <TabDisplayRules />
        <DisplayRules />
        <EnableRules />
      <LocLabels />
  4. Replace the highlighted line yellow with the following XML
  5. <CommandDefinition Id="Mscrm.ReportMenu.Form">
          <EnableRule Id="Mscrm.FormStateNotNew" />
          <DisplayRule Id="Mscrm.ReadReport" />
        <Actions />
  6. Save the file and overwrite the Customization file in your exported solution zip file with this file.
  7. Import the solution zip file and publish it. It’s done.

By using  Ribbon Work Bench 2013

Report button can be easily restored using “Ribbon Work Bench 2013”. Check for the step by step instructions.
Note: Make sure in the step 4 of the instructions,  “Form” is selected in the upper right corner as shown in the following screen shot.


Thursday, November 7, 2013

Behaviour of the “Add New” button on sub grids in CRM2013

CRM2013 displays the subgrids slightly differently than CRM2011.  The “Add New” button on subgrids behaves in two different ways.


Scenario 1

The following screen shot displays the contact grid on the account form.


The “+” icon represents the “Add New Contact” button. When you click on the button, it pops up the search box as shown in the following screen shot.


On click of the image  button, the system displays the following pop up. You need to click on “+ New” button at the bottom right corner to open a new contact form.


Scenario 2

The following screen display the opportunities grid on the account entity.


On click of the “+” button. the system displays the new opportunity form.


Reason for the behaviour

The difference in the behaviour is  because of “Field Requirement“ property of the lookup field.

In I:N relationship, if the “Field Requirement” property of the look field is “Business Required” then “Add New” button will display a new record form. The following screen shot displays “Field Requirement” of “Business Required” for the “Potential Customer” field in opportunity entity.



And if the “Field Requirement” property of the look field is not “Business Required” then “Add New” button will display search box as discussed in scenario 1. The following screen shot displays “Field Requirement” of “Optional” for the “Company Name” field in contact entity.