Problem with Plugin RRS feed

  • Question

  • I have written a few plugins in vb with no problems, however, I am trying to write a similar plugin to fire on the account create. The plugin fires a SQL stored procedure to update a legacy application. After spending hours checking and double checking the SQL Stored Procedure and the plugin, against ones that work, I have stripped it right down to a stored procedure just adding in the 'name' value from the account entity. I have tested the Stored procedure under SQL Manager and under a separate vb application and it works, however when fired from CMR, I get the following error

    'The given key was not present n the directory'

    Unhandled Exception: System.ServiceModel.FaultException`1[[Microsoft.Xrm.Sdk.OrganizationServiceFault, Microsoft.Xrm.Sdk, Version=, Culture=neutral, PublicKeyToken=31bf3856ad364e35]]: The given key was not present in the dictionary.Detail:
    <OrganizationServiceFault xmlns:i="http://www.w3.org/2001/XMLSchema-instance" xmlns="http://schemas.microsoft.com/xrm/2011/Contracts">
      <ErrorDetails xmlns:d2p1="http://schemas.datacontract.org/2004/07/System.Collections.Generic">
          <d2p1:value xmlns:d4p1="http://www.w3.org/2001/XMLSchema" i:type="d4p1:string">0</d2p1:value>
          <d2p1:value xmlns:d4p1="http://www.w3.org/2001/XMLSchema" i:type="d4p1:string">-2146233088</d2p1:value>
      <Message>The given key was not present in the dictionary.</Message>
      <InnerFault i:nil="true" />

    [vbClients: vbClients.ClientAdminAdd.ClsClientAdd]
    [2c1fd5bc-df89-e411-80ec-00155d01d308: vbClients.ClientAdminAdd.ClsClientAdd: Create of account]


    I don't understand this is failing, where other plugins set up the same way are working

    Dont ask me .. i dont know

    Monday, December 22, 2014 1:51 PM


All replies

  • I believe you will need to write some trace for specific steps or you can try to debug the plugin.

    Debug a plugin:


    Write trace in plugin


    Then you will get which speicifc steps faced the error.

    Tuesday, December 23, 2014 7:00 AM
  • Is there any field level security on the entity that this plugin is firing on?  I was getting a something similar in a plugin that was trying to retrieve values from a global optionset that had field level security on it.

    Plugins are unable to update the record if there is field level security on an attribute, even when you are not updating that specific field.

    Like Wilson said, best bet is to debug.  I usually do the remote debugging within a VM because the remote debugging will lock up the CRM server for other users while you are stepping through the plugin code.  But this will let you see the values with each step.

    Jason Peterson

    Tuesday, December 23, 2014 3:12 PM