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

Announcements

News and Announcements icon
Community site session details

Community site session details

Session Id :
Power Platform Community / Forums / Power Pages / Power Pages form confi...
Power Pages
Answered

Power Pages form confirmation window for deactivating record - NOT IN MODEL DRIVEN VIEW

(0) ShareShare
ReportReport
Posted on by

On my Power Page when I open the edit form I have a button to deactivate the record added via the forms additional settings. When a user clicks the button I want a window/alert to pop up asking them to confirm. If they select "ok" deactivate the record. If they select "cancel" do nothing close the window. I have the window popping up upon selecting the button. But I am struggling with the logic for the "Ok" to deactivate and "cancel" to do nothing but close the window. I have the code added to the additional settings for the form under the Javascript section

 

$(document).ready(function () {
  $('.btn-default').on("click", function  () {
if (confirm('Are you sure you want to remove this case?')) {
// Deactivate Case!

function DeactivateAccountRecord(){
  var entity = {replacewithlogicalnameofentity};
  entity.statecode = 1;
  entity.statuscode = 706040001;


  Xrm.WebApi.online.updateRecord("replacewithlogicalnameofentity", entity.id, entity).then(
    function success(result) {
        var updatedEntityId = result.id;
    },
    function(error) {
        Xrm.Utility.alertDialog(error.message);
    }
);
}
console.log('The case was removed.');
} else {
// Do nothing!
console.log('The case was not deleted');
}})})
Categories:
I have the same question (0)
  • Verified answer
    Fubar Profile Picture
    8,491 Super User 2026 Season 1 on at

    IIs there a reason you are not using the out of the box confirmation? (configured in the Forms Additional Settings)

    if you don't see it, tick the Advanced on the top right of the Action Button Configuration grid, and you will see a Confirmation Yes/No on the deactivate button config.

    Fubar_2-1706137061299.png

     

     

     

    Fubar_1-1706137006136.png

     

  • mjackson122 Profile Picture
    on at

    @Fubar I did not know that existed thank you so much. However, from the grid view the remove case (deactivation) does not display the confirmation window. How do I hide the option from the grid drop down?

    mjackson122_0-1706208070672.png

     

  • mjackson122 Profile Picture
    on at

    I found it..it was on the list setting under options

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 Users!

Kudos to our 2025 Community Spotlight Honorees

Congratulations to our 2025 community superstars!

Congratulations to the April Top 10 Community Leaders!

These are the community rock stars!

Leaderboard > Power Pages

#1
Valantis Profile Picture

Valantis 49

#2
11manish Profile Picture

11manish 33

#3
Haque Profile Picture

Haque 28

Last 30 days Overall leaderboard