web
You’re offline. This is a read only version of the page.
close
Skip to main content

Announcements

No record found.

News and Announcements icon
Community site session details

Community site session details

Session Id :
Customer experience | Sales, Customer Insights,...
Unanswered

Edit Total Tax on Quotes

(0) ShareShare
ReportReport
Posted on by 299

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

I have the same question (0)
  • Esteban Coto Alfaro Profile Picture
    Microsoft Employee on at

    Hello, I think that you are missing the "AttributeCollection" on line 11 and 12, try this:

    updateEntity.Attributes["new_customtax"] = new Money(amount);

    updateEntity.Attributes["totaltax"] = new Money(amount);

    Thanks!

    Community Support Team - Esteban

    If this Post helps, then please consider Accept as solution to help the other members find it more quickly.

  • z.sam Profile Picture
    299 on at

    Thanks for your reply Esteban,

    I don't really know what's the difference between these two syntax.

    updateEntity.Attributes["new_customtax"]

    updateEntity["new_customtax"]

    I don't get syntax error also,

    Regards

Under review

Thank you for your reply! To ensure a great experience for everyone, your content is awaiting approval by our Community Managers. Please check back later.

Helpful resources

Quick Links

Introducing the 2026 Season 1 community Super Users

Congratulations to our 2026 Super Stars!

Meet the Microsoft Dynamics 365 Contact Center Champions

We are thrilled to have these Champions in our Community!

Congratulations to the March Top 10 Community Leaders

These are the community rock stars!

Leaderboard > Customer experience | Sales, Customer Insights, CRM

#1
ManoVerse Profile Picture

ManoVerse 151 Super User 2026 Season 1

#2
11manish Profile Picture

11manish 134

#3
Jimmy Passeti Profile Picture

Jimmy Passeti 55 Most Valuable Professional

Last 30 days Overall leaderboard

Product updates

Dynamics 365 release plans