Hi all,
I am writing a plugin on account entity, i.e. when account record is created a new contact record must also be created subsequently. My code is as shown below:
try
{
Entity entity = (Entity)context.InputParameters["Target"];
Guid accID = (Guid)context.OutputParameters["id"]; // error is in this line "The given key is not present in the dictionary"
Entity contact = new Entity("contact");
contact["lastname"] = "Test";
contact["parentcustomerid"] = new EntityReference(entity.LogicalName, accID);
service.Create(contact);
}
catch (Exception e)
{
throw new InvalidPluginExecutionException(e.Message);
}
It is throwing me an error saying "The given key is not present in the dictionary".
I am not sure as to what is the problem.
*This post is locked for comments