Hi there,
The scenario is that I want to have tax on quote not in quote line items.(as you know the field is disabled) I created a decimal field "percent of the tax" that may have vales 0 or 9, then with the code below I calculate total tax and update it,
but it doesn't get updated. Any Ideas?
public string IntenalExcuter(IOrganizationService orgsrv, EntityReference quote) { Entity quoteEnt = orgsrv.Retrieve(quote.LogicalName, quote.Id, new ColumnSet("totallineitemamount","totaltax","new_taxpercent", "new_customtax")); string message = ""; Entity updateEntity = new Entity(quote.LogicalName); updateEntity.Id = quote.Id; decimal totallineitemamount = quoteEnt.GetAttributeValue("totallineitemamount").Value; decimal taxpercent = quoteEnt.GetAttributeValue("new_taxpercent") / 100; decimal amount = totallineitemamount * taxpercent ; updateEntity["new_customtax"] = new Money(amount); updateEntity["totaltax"] = new Money(amount); try { orgsrv.Update(updateEntity); } catch (Exception e) { message= e.Message; } return message; }
Best Regards
Sam