Hi All,
I have one entity in which there is a sub grid. In my entity i have a field "amount" which will be updated every time we add a new sub grid item. I have created a plugin shown below which runs on create new sub grid item. below is the code:
if(context.InputParameters.Contains("Target") && context.InputParameters["Target"] is Entity)
{
Entity rate = (Entity)context.InputParameters["Target"];
Guid id = new Guid();
if(rate.Attributes["one_rateitems"]!=null)
{
id = ((EntityReference)rate.Attributes["one_rateitems"]).Id;
}
Decimal amount = new Decimal();
if (rate.Attributes["one_subtotalmaterialsell"] != null)
{
amount = ((Money)rate.Attributes["one_subtotalmaterialsell"]).Value;
}
ColumnSet cs = new ColumnSet(new String[]{"one_amount"});
Entity ec = service.Retrieve("one_costingtype", id,cs);
ec.Attributes["one_amount"] = new Money(amount);
service.Update(ec);
}
when I debug this code, i see that values are coming up in the amount field but while running the plugin, I don't see the value getting updated in amount field. can anyone help?









