In CRM 2013, when a Lead is set as Qualified by the user, the lead is converted into a Opportunity. When this happens a record is also created in the entity Contact and Account. When a plugin is involved in the process it is necessary in the plugin to use the following code
if (context.MessageName.ToLower() == "create" && entity.Attributes.Contains("originatingleadid") && entity["originatingleadid"] != null)
{
return;
}
else
{
//plugin code
}
So that the plugin only executes when a contact / account is created and not when a lead is being converted to a opportunity
My question is how is this achievable when a Quote is being converted to a Order as when I am doing this process my plugin for Order is being activated and is throwing a business process error as 'the given key is not present in the dictionary'