locked
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=6.0.0.0, 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">
      <ErrorCode>-2147220891</ErrorCode>
      <ErrorDetails xmlns:d2p1="http://schemas.datacontract.org/2004/07/System.Collections.Generic">
        <KeyValuePairOfstringanyType>
          <d2p1:key>OperationStatus</d2p1:key>
          <d2p1:value xmlns:d4p1="http://www.w3.org/2001/XMLSchema" i:type="d4p1:string">0</d2p1:value>
        </KeyValuePairOfstringanyType>
        <KeyValuePairOfstringanyType>
          <d2p1:key>SubErrorCode</d2p1:key>
          <d2p1:value xmlns:d4p1="http://www.w3.org/2001/XMLSchema" i:type="d4p1:string">-2146233088</d2p1:value>
        </KeyValuePairOfstringanyType>
      </ErrorDetails>
      <Message>The given key was not present in the dictionary.</Message>
      <Timestamp>2014-12-22T13:47:36.4266046Z</Timestamp>
      <InnerFault i:nil="true" />
      <TraceText>

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


    </TraceText>
    </OrganizationServiceFault>

    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

Answers

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:

    http://msdn.microsoft.com/en-us/library/gg328574.aspx

    Write trace in plugin

    https://crmbusiness.wordpress.com/2011/02/08/crm-2011-you-can-now-add-tracing-to-your-plugins/

    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