Hi there,
The scenario is that we just have tax on quote and also we may not have it. I created a decimal field the has the percent of the tax that may be 0 or 9. I wrote a code to calculate a replace the total tax , but it doesn't work. What's the point.
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<Money>("totallineitemamount").Value;
decimal taxpercent = quoteEnt.GetAttributeValue<decimal>("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