Hi all,
I am facing the below issue kindly help..
In order product entity i am having two look up fields named existing product which is look up to product entity and order product pointer field which is look up to custom entity named order product pointer. So on the updation of order product record
utility created the new record in custom entity named order product pointer and set that record as a look up value in order product pointer field which is on order product form.
So that utility running fine for 50 records if i set more than 50 records like 51, 52 etc... in plugin that it throws the message "exceeded".
Below is snap shot of code
for (int i = 0; i < CustomOrderProductRecords_count; i++) {
Entity OrderProduct = new Entity("salesorderdetail");
Entity ent = CustomOrderProductRecords[i];
Guid OrderId = ((EntityReference)ent.Attributes["salesorderid"]).Id;
string OrderName = ((EntityReference)ent.Attributes["salesorderid"]).Name;
// int OrderState = ((OptionSetValue)ent.Attributes["salesorderstatecode"]).Value;
// throw new InvalidPluginExecutionException("Id: " + OrderId + " OrderName: " + OrderName + " , State: " + OrderState.ToString());
//&& !OrderId.ToString().ToLower().Contains("eb98b3b3-4253-e111-b398-1cc1dee8ea01")
if (i < 50 )
{
// If Existing Product is updated
if (ent.Attributes.Contains("productid") && (EntityReference)ent.Attributes["productid"] != null)
{
Guid ProductId = ((EntityReference)ent.Attributes["productid"]).Id;
string ProductName = RetrieveProduct(ref ent, ref context, ref serviceProvider, ref ProductId);
//throw new InvalidPluginExecutionException("ProductID:" + ProductName);
CustomOrderProductId = RetrieveCreatedCustomOrderProduct(ref ent, ref context, ref serviceProvider, ref ProductName);
//Set CustomOrderProduct in OrderProduct.
// entity.Attributes["new_product"] = new EntityReference("new_orderproductpointer", CustomOrderProductId);
}
else if (ent.Attributes.Contains("productdescription") && (string)ent.Attributes["productdescription"] != string.Empty)
{
//throw new InvalidPluginExecutionException("productdescription is present ");
// If Write-in Product is updated
string ProductName = (string)ent.Attributes["productdescription"];
CustomOrderProductId = RetrieveCreatedCustomOrderProduct(ref ent, ref context, ref serviceProvider, ref ProductName);
//Set CustomOrderProduct in OrderProduct.
//entity.Attributes["new_product"] = new EntityReference("new_orderproductpointer", CustomOrderProductId);
}
// Set Field Values -------------------------------------
OrderProduct.Attributes["new_product"] = new EntityReference("new_orderproductpointer", CustomOrderProductId);
OrderProduct.Attributes["salesorderdetailid"] = ent.Attributes["salesorderdetailid"];
// Update record
// throw new InvalidPluginExecutionException("flag is being true: pre ");
service.Update(OrderProduct);
}
}
I am using crm 2013 online.
Need help urgently as i need to update more than 50000 records.
Deepak Jangra