Skip to main content

Notifications

Announcements

No record found.

Community site session details

Community site session details

Session Id :
Microsoft Dynamics CRM (Archived)

Prevent OnSave Confirmation dialog on Xrm.page.data.refesh

(0) ShareShare
ReportReport
Posted on by

Hi,

I have one button on ribbon which when clicked sets entity in declined(inactive) state and fill out field "abc" with value "xyz" on form.

if I add Xrm.Page.data.refresh() page refreshes and save dialog comes which I want to avoid.

If I remove Xrm.Page.data.refresh(), I need to refresh the page manually to see if field "abc" is set with value "xyz"

function inactiverecord() {
var terminationControl = Xrm.Page.getControl("abc");
if (terminationControl != null) {
terminationControl.getAttribute().setValue(xyz);
var id = Xrm.Page.data.entity.getId();
Xrm.Page.getAttribute("abc").getSubmitMode("never");
Xrm.Page.data.entity.save();
SetStatus("entity", id, 1, 7720007, function(result) { //set entity declined inactive
}, null, false);
}
}
// Run the failiure management logic and erase failiures from list
var success = manageFailures();
Xrm.Page.data.refresh();

*This post is locked for comments

  • Verified answer
    RE: Prevent OnSave Confirmation dialog on Xrm.page.data.refesh

    Hi All,

    Thanks for all the responses. I kept the same code as mentioned in the first question by me and its no more refreshing the page. I couldn't find the solution.

    As this error is no more there, I will just mark this answer.

  • Suggested answer
    sandeepstw Profile Picture
    sandeepstw 4,601 on at
    RE: Prevent OnSave Confirmation dialog on Xrm.page.data.refesh

    Hi,

    Please check this article -

    community.dynamics.com/.../javascript-prevent-save

  • Suggested answer
    gdas Profile Picture
    gdas 50,089 Moderator on at
    RE: Prevent OnSave Confirmation dialog on Xrm.page.data.refesh

    Hi ,

    Try to do like this  -

    function inactiverecord() {
        var terminationControl = Xrm.Page.getControl("abc");
        if (terminationControl != null) {
            terminationControl.getAttribute().setValue(xyz);
            var id = Xrm.Page.data.entity.getId();
            Xrm.Page.getAttribute("abc").getSubmitMode("never");        
            Xrm.Page.data.save().then(successSubmitCallback, errorSubmitCallback);
    
        }
    }
    

    //Implement logic here in success callback after Save Operation function successSubmitCallback() { SetStatus("entity", id, 1, 7720007, function (result) { //set entity declined inactive }, null, false); } function errorSubmitCallback() { }


  • RE: Prevent OnSave Confirmation dialog on Xrm.page.data.refesh

    Yes you are correct I don't need submit mode. I removed it. I replaced Xrm.Page.data.refresh(); with Xrm.Utility.openEntityForm(entityName, id) but still save confirmation dialog opens.

    I don't want that save dialog and want to refresh.

  • Suggested answer
    Flydancer Profile Picture
    Flydancer 1,332 on at
    RE: Prevent OnSave Confirmation dialog on Xrm.page.data.refesh

    You dont need this because you're only getting the value, did you want to setSubmitMode?:

    Xrm.Page.getAttribute("abc").getSubmitMode("never");

    Try refreshing the form with 

    Xrm.Utility.openEntityForm(entityName, id)

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

Daivat Vartak – Community Spotlight

We are honored to recognize Daivat Vartak as our March 2025 Community…

Announcing Our 2025 Season 1 Super Users!

A new season of Super Users has arrived, and we are so grateful for the daily…

Kudos to the February Top 10 Community Stars!

Thanks for all your good work in the Community!

Leaderboard

#1
André Arnaud de Calavon Profile Picture

André Arnaud de Cal... 292,516 Super User 2025 Season 1

#2
Martin Dráb Profile Picture

Martin Dráb 231,432 Most Valuable Professional

#3
nmaenpaa Profile Picture

nmaenpaa 101,156

Leaderboard

Featured topics

Product updates

Dynamics 365 release plans