Skip to main content

Notifications

Community site session details

Community site session details

Session Id : 2TjeZyyDfxevpDGXoC/MCJ
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
    7,885 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

🌸 Community Spring Festival 2025 Challenge Winners! 🌸

Congratulations to all our community participants!

Warren Belz – Community Spotlight

We are honored to recognize Warren Belz as our May 2025 Community…

Congratulations to the April Top 10 Community Stars!

Thanks for all your good work in the Community!

Leaderboard > Power Pages - Customize & Extend

#1
Ajlan Profile Picture

Ajlan 4

#2
Fubar Profile Picture

Fubar 2 Super User 2025 Season 1

#2
CBDEV Profile Picture

CBDEV 2

Overall leaderboard

Featured topics

Loading started