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 :
Microsoft Dynamics CRM (Archived)

Save and Refresh a Quote form from HTML button

(0) ShareShare
ReportReport
Posted on by

Hi,

I created an html button, I do simple calculations and want to save and refresh the form so the user does not have to?

I've tried.

formContext.data.entity.save("save");

and
Xrm.Page.data.entity.save();

and
//setTieout(function () {
//Xrm.Page.data.save().then(closeemailform, errorCallback);
//}, 6000);

I even tried this as it was the only thing that worked on a CRM form, but not in the html form.

Xrm.Page.data.refresh(true);

Any ideas?

*This post is locked for comments

I have the same question (0)
  • Verified answer
    Kokulan Profile Picture
    18,054 on at

    Hi

    Could you please try parent.Xrm.Page.data.refresh(true); from your webresource?

    ScreenClip-_5B00_322_5D00_.png

    https://docs.microsoft.com/en-us/dynamics365/customer-engagement/developer/webpage-html-web-resources

    I have responded to your other post about refreshing the quote form, not sure if you have tried that as well.

  • Emad Hanna Profile Picture
    on at

    That was the missing piece thank you again Kokulan.

  • Emad Hanna Profile Picture
    on at

    Hi, all of the sudden I'm getting a very strange behavior.  I was updating a field and then the now the field reverts to it's previous value.

    For example the field had a $5 and when I press my button it changes it to $10, but then instantly it reverts back to $5.  It's the craziest thing?

    Here is my code.

      function CalcMarginButtonClick()

    {

                         //refresh before getting the new number

                         parent.Xrm.Page.data.refresh(true);

                      var MarTotal = window.parent.Xrm.Page.getAttribute("new_margin_total").getValue();

                      var TotalAmt = window.parent.Xrm.Page.getAttribute("totalamount").getValue();

                      var Frieght = window.parent.Xrm.Page.getAttribute("aaise_freightcost").getValue();

                      var Tax = window.parent.Xrm.Page.getAttribute("totaltax").getValue();

                       if (TotalAmt  != 0 || MarTotal != 0)

                           {

                               var Margin= window.parent.Xrm.Page.getAttribute("new_marginofrevenue").getValue();

                               var MarRev = (MarTotal/(TotalAmt - Frieght - Tax)) * 100;

                               window.parent.Xrm.Page.getAttribute("new_marginofrevenue").setValue(MarRev);

                               window.parent.Xrm.Page.getAttribute("new_marginofrevenue").setSubmitMode("always");

                               parent.Xrm.Page.data.refresh(true);

                            }

  • Suggested answer
    Kokulan Profile Picture
    18,054 on at

    Hi

    Is there any particular reason for the first refresh?

    The reason for the value reverting is that you have not forced a save after you set the values.  Since you called the refresh, it reloaded the page again displaying old value.

    If these fields are on Quote itself, you dont need the second refresh i think

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 April Top 10 Community Leaders

These are the community rock stars!

Leaderboard > 🔒一 Microsoft Dynamics CRM (Archived)

#1
ScottDurow Profile Picture

ScottDurow 2

#2
GJones Profile Picture

GJones 1

Last 30 days Overall leaderboard

Featured topics

Product updates

Dynamics 365 release plans