Skip to main content
Community site session details

Community site session details

Session Id : SSvcMr9xFBRINhDTKo5jfo
Power Pages - Customize & Extend
Answered

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

Like (0) ShareShare
ReportReport
Posted on 24 Jan 2024 20:12:08 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:
  • mjackson122 Profile Picture
    on 25 Jan 2024 at 19:14:08
    Re: Power Pages form confirmation window for deactivating record - NOT IN MODEL DRIVEN VIEW

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

  • mjackson122 Profile Picture
    on 25 Jan 2024 at 18:41:31
    Re: Power Pages form confirmation window for deactivating record - NOT IN MODEL DRIVEN VIEW

    @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

     

  • Verified answer
    Fubar Profile Picture
    8,023 Super User 2025 Season 1 on 24 Jan 2024 at 22:58:17
    Re: Power Pages form confirmation window for deactivating record - NOT IN MODEL DRIVEN VIEW

    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

     

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

Paul Stork – Community Spotlight

We are honored to recognize Paul Stork as our July 2025 Community…

Congratulations to the June Top 10 Community Leaders!

These are the community rock stars!

Announcing the Engage with the Community forum!

This forum is your space to connect, share, and grow!

Leaderboard > Power Pages

#1
Lucas001 Profile Picture

Lucas001 60 Super User 2025 Season 1

#2
Fubar Profile Picture

Fubar 55 Super User 2025 Season 1

#3
surya narayanan Profile Picture

surya narayanan 35

Featured topics