Skip to main content

Notifications

Community site session details

Community site session details

Session Id : cQU+a7JWXhTpU5bsuOKIDz
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,846 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

Understanding Microsoft Agents - Introductory Session

Confused about how agents work across the Microsoft ecosystem? Register today!

Markus Franz – Community Spotlight

We are honored to recognize Markus Franz as our April 2025 Community…

Kudos to the March Top 10 Community Stars!

Thanks for all your good work in the Community!

Leaderboard

#1
WarrenBelz Profile Picture

WarrenBelz 146,670 Most Valuable Professional

#2
RandyHayes Profile Picture

RandyHayes 76,287 Super User 2024 Season 1

#3
Pstork1 Profile Picture

Pstork1 66,004 Most Valuable Professional

Leaderboard

Featured topics

Loading started