locked
crm 2011 : plugin error : "The given key was not present in the dictionary." RRS feed

  • Question

  • in debugging i got this 

    ex {"The given key was not present in the dictionary."} System.Exception {System.Collections.Generic.KeyNotFoundException}

    and code  is :

    // if (context.OutputParameters.Contains("id"))
                                //{
                                    Guid regardingobjectid = new Guid(context.OutputParameters["id"].ToString());
                                    string regardingobjectidType = "contact";

                                    followup["regardingobjectid"] =
                                    new EntityReference(regardingobjectidType, regardingobjectid);

                                //}

    in update plugin:  i try to create letter activity

    in that i try to set regardingobjectid field but it give me this error


    Ashish

    Thursday, March 22, 2012 7:58 PM

Answers

  • Hi

     This  it because its unable to find "regardingobjectid" attribute

     on the followup. As this attribute isnt present in  input parameter propertybag within  Plugin Context

      ( Hope you dont find my reply offending and Mark it as  Abuse , As you did last time )

    hth

    dkay

    if the response answered your question, please take a minute and mark the response as an answer.

        


    • Edited by D kay Thursday, March 22, 2012 9:25 PM
    • Marked as answer by Ashish Sharma Engg Thursday, March 22, 2012 10:12 PM
    Thursday, March 22, 2012 9:24 PM

All replies

  • Hi

     This  it because its unable to find "regardingobjectid" attribute

     on the followup. As this attribute isnt present in  input parameter propertybag within  Plugin Context

      ( Hope you dont find my reply offending and Mark it as  Abuse , As you did last time )

    hth

    dkay

    if the response answered your question, please take a minute and mark the response as an answer.

        


    • Edited by D kay Thursday, March 22, 2012 9:25 PM
    • Marked as answer by Ashish Sharma Engg Thursday, March 22, 2012 10:12 PM
    Thursday, March 22, 2012 9:24 PM
  • Thanks  Crm_Developer,  

    i know that unable to find ''regardingobjectid "

    but how to i pass id in below code? 

    context.OutputParameters["id"].ToString()


    Ashish

    Thursday, March 22, 2012 10:14 PM
  •  you dont have to pass ID

     outputparameter is  the id of the newly created record  return by the crm platform

     during a CREATE operation

    hth

    dkay

    Friday, March 23, 2012 6:03 AM