Registered a plugin on create (post operation). It works, but after that I added two fields on the form. On create I am updating the field values of the form. It works but it fails while comparing result entity attribute:
QueryExpression QrySales = new QueryExpression() { EntityName = Sales.LogicalName, ColumnSet = new ColumnSet(true) };
EntityCollection SalesCollec = Service.RetrieveMultiple(QrySales);
foreach (Entity sales in SalesCollec.Entities)
{
if (sales["new_membername"].ToString() == UpdateSales["new_membername"].ToString())
{
index = index + 1;
}
}
UpdateSales["new_index"] = index + 1;
Service.Update(UpdateSales);