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

Community site session details

Session Id :

Disable Auto Save for Individual Forms in Model Driven Apps

Ram Prakash Profile Picture Ram Prakash 2,287

Introduction:

 

In this Blog, we will see how to Disable Auto Save Functionality on Particular Form Using JavaScript.

 

Implementation Steps:

 

In my Previous Blog I have explained how to enable or disable AUTO Save functionality in Model Driven Apps. In this Blog we will see how to Prevent Auto Save in Particular or Individual forms using JavaScript.

 

Steps to Follow:

 

1. Navigate to https://make.powerapps.com

 

2. Navigate to Solution and Open the Solution which you already have else Create a New Solution

 

3. Create or Add Existing Table where you want to Prevent Auto Save functionality.

 

4. Once Table is Added, Add your Existing Web Resource. Else Create a new Web Resource.

 

5. Steps to Follow to Create a Web Resource

 

6. Add below JavaScript into your Web Resource

  

function preventAutoSave(executionContext) {
    var formContext = executionContext.getFormContext();
    var eventArgs = executionContext.getEventArgs();
    if (eventArgs.getSaveMode() == 70) {
        eventArgs.preventDefault();
    }
} 

  

7. Please find the Event Modes that will perform on SAVE operation

 

Event Mode Value
 Save 1
 Save And Close 2
 Save and New 59
 Save as Completed 58
 AutoSave 70

 

8. Now Open the Table where you want to add Web Resource --> Click Forms --> Open the Form

 

9. Once Form Opens Click Form Library and Click Add Library and Search for the Library and Select the Check Box and Click Add

 7563.png

 

10. Once Added --> Click Events at the RIGHT Side --> Select OnSave --> Click ADD EVENT HANDLER --> Input Function name as preventAutoSave --> Make Sure You Select Check Box - Pass Execution Context

 

11. Now Click Ok --> Click Save and Click Publish.

 

That's it

Comments

*This post is locked for comments