Hi all, I have written a plugin asynchronously populate the entitlement field during a case creation. Although I am getting an error of (System.Collections.Generic.KeyNotFoundException: The given key was not present in the dictionary), I have registered my plugin in the post-operation pipeline with asynchronous execution mode. here is my snippet :
if (inputParams.Contains("Target") && inputParams["Target"] != null && inputParams["Target"] is Entity)
{
Entity Case = new Entity("incident");
Guid caseGui = Case.Id;
string customerName = ((EntityReference)(Case.Attributes["customerid"])).Name;
Entity LovQuery = new Entity("entitlement");
Guid Entilguid = LovQuery.Id;
Entity allChecker = svc.Retrieve("entitlement", Entilguid, new ColumnSet(true));
if (allChecker.Attributes.Contains(customerName))
{
Guid EntitlementGuid = allChecker.Id;
Case["entitlementid"] = new EntityReference("entitlement", EntitlementGuid);
}
svc.Update(Case);
I just started to write a plugin , forgive me if I made any newbie mistake. please help me if I made any mistake, thank you .