Discussion:
0x80040265 The given key was not present in the dictionary
(too old to reply)
Loxy
2009-02-24 06:47:00 UTC
Permalink
Hi,

I am facing a issue when creating a record of case(incident) entity?

error : 0x80040265 The given key was not present in the dictionary

the following is shown the simple code:

protected Guid CreateCaseRecord(CrmService crmService)
{
incident inc = new incident();
inc.description = " the description content";
inc.title = "ABC testing by 00012222";
inc.caseorigincode = new Picklist();
inc.caseorigincode.Value = 2;

inc.customerid = new Customer();
inc.customerid.type = EntityName.account.ToString();
inc.customerid.Value = new
Guid("80450C5E-7701-DE11-BC6D-0003FF4F593C");

Guid incGuid = crmService.Create(inc);

return incGuid;
}

but i have some times to create the record correctly, i am at a loss why it
failed.
AntonioLG
2009-02-24 08:20:01 UTC
Permalink
Hi,

Is it possible that there's no record in you database with
Guid("80450C5E-7701-DE11-BC6D-0003FF4F593C")? An account record in this
case...
Post by Loxy
Hi,
I am facing a issue when creating a record of case(incident) entity?
error : 0x80040265 The given key was not present in the dictionary
protected Guid CreateCaseRecord(CrmService crmService)
{
incident inc = new incident();
inc.description = " the description content";
inc.title = "ABC testing by 00012222";
inc.caseorigincode = new Picklist();
inc.caseorigincode.Value = 2;
inc.customerid = new Customer();
inc.customerid.type = EntityName.account.ToString();
inc.customerid.Value = new
Guid("80450C5E-7701-DE11-BC6D-0003FF4F593C");
Guid incGuid = crmService.Create(inc);
return incGuid;
}
but i have some times to create the record correctly, i am at a loss why it
failed.
Loxy
2009-02-24 08:34:06 UTC
Permalink
Thanks AntonioLg, the GUID is the existing guid of account..Now I am
debugging it. find that I had a Plugin of case assignment before. I disable
the plugin. the case record can be created.
But I register the plugin again, i face the above issue once again.
Post by AntonioLG
Hi,
Is it possible that there's no record in you database with
Guid("80450C5E-7701-DE11-BC6D-0003FF4F593C")? An account record in this
case...
Post by Loxy
Hi,
I am facing a issue when creating a record of case(incident) entity?
error : 0x80040265 The given key was not present in the dictionary
protected Guid CreateCaseRecord(CrmService crmService)
{
incident inc = new incident();
inc.description = " the description content";
inc.title = "ABC testing by 00012222";
inc.caseorigincode = new Picklist();
inc.caseorigincode.Value = 2;
inc.customerid = new Customer();
inc.customerid.type = EntityName.account.ToString();
inc.customerid.Value = new
Guid("80450C5E-7701-DE11-BC6D-0003FF4F593C");
Guid incGuid = crmService.Create(inc);
return incGuid;
}
but i have some times to create the record correctly, i am at a loss why it
failed.
Kay-Christian Wessel
2009-02-24 11:53:51 UTC
Permalink
This is probably because you are using an attribute in your other plugin
which is not inserted in this code. If your other plugin reads from Target,
this attribute will not be inside Target. I assume the Plugin is of type
Create on the Incident entity.

In this other plugin you need to check if the attributes are present before
you read their values, otherwise you get this error. You also need to chech
if the value is null before assigning it to a variable.

You could also use the Image functionality to get all the attributes instead
of the attributes included in Target.

Kay
Post by Loxy
Thanks AntonioLg, the GUID is the existing guid of account..Now I am
debugging it. find that I had a Plugin of case assignment before. I disable
the plugin. the case record can be created.
But I register the plugin again, i face the above issue once again.
Post by AntonioLG
Hi,
Is it possible that there's no record in you database with
Guid("80450C5E-7701-DE11-BC6D-0003FF4F593C")? An account record in this
case...
Post by Loxy
Hi,
I am facing a issue when creating a record of case(incident) entity?
error : 0x80040265 The given key was not present in the dictionary
protected Guid CreateCaseRecord(CrmService crmService)
{
incident inc = new incident();
inc.description = " the description content";
inc.title = "ABC testing by 00012222";
inc.caseorigincode = new Picklist();
inc.caseorigincode.Value = 2;
inc.customerid = new Customer();
inc.customerid.type = EntityName.account.ToString();
inc.customerid.Value = new
Guid("80450C5E-7701-DE11-BC6D-0003FF4F593C");
Guid incGuid = crmService.Create(inc);
return incGuid;
}
but i have some times to create the record correctly, i am at a loss why it
failed.
Loxy
2009-02-24 16:00:01 UTC
Permalink
Thanks very much. Kay. the problem is my webpage simple record created
doesn't have required value for case assigment
Post by Kay-Christian Wessel
This is probably because you are using an attribute in your other plugin
which is not inserted in this code. If your other plugin reads from Target,
this attribute will not be inside Target. I assume the Plugin is of type
Create on the Incident entity.
In this other plugin you need to check if the attributes are present before
you read their values, otherwise you get this error. You also need to chech
if the value is null before assigning it to a variable.
You could also use the Image functionality to get all the attributes instead
of the attributes included in Target.
Kay
Post by Loxy
Thanks AntonioLg, the GUID is the existing guid of account..Now I am
debugging it. find that I had a Plugin of case assignment before. I disable
the plugin. the case record can be created.
But I register the plugin again, i face the above issue once again.
Post by AntonioLG
Hi,
Is it possible that there's no record in you database with
Guid("80450C5E-7701-DE11-BC6D-0003FF4F593C")? An account record in this
case...
Post by Loxy
Hi,
I am facing a issue when creating a record of case(incident) entity?
error : 0x80040265 The given key was not present in the dictionary
protected Guid CreateCaseRecord(CrmService crmService)
{
incident inc = new incident();
inc.description = " the description content";
inc.title = "ABC testing by 00012222";
inc.caseorigincode = new Picklist();
inc.caseorigincode.Value = 2;
inc.customerid = new Customer();
inc.customerid.type = EntityName.account.ToString();
inc.customerid.Value = new
Guid("80450C5E-7701-DE11-BC6D-0003FF4F593C");
Guid incGuid = crmService.Create(inc);
return incGuid;
}
but i have some times to create the record correctly, i am at a loss why it
failed.
Continue reading on narkive:
Loading...