In this tutorial I show you how to automatically increment a version number on a Dataverse record in Power Apps using JavaScript.
This is a short, focused video covering one specific but powerful technique. Every time a record is saved the version number updates automatically. No manual input, no human error, just clean automatic versioning built directly into your Model-Driven App.
What we cover:
1️⃣Writing a namespaced JavaScript function following Power Apps best practices
2️⃣Attaching the function to the On Save event of a Model-Driven App form
3️⃣Using setSubmitMode to ensure the value always persisted on save
4️⃣Testing the versioning behaviour live in the app
📌 JavaScript Function:
// Function to run on form save
function incrementVersionNumber(executionContext) {
// Get the form context from the execution context
var formContext = executionContext.getFormContext();
// Retrieve the current value of the youtube_versionnumber field
var currentValue = formContext.getAttribute("youtube_versionnumber").getValue();
// If the field is empty (first time), set it to 1
if (currentValue === null) {
formContext.getAttribute("youtube_versionnumber").setValue(1);
} else {
// Otherwise, increment the existing value by 1
formContext.getAttribute("youtube_versionnumber").setValue(currentValue + 1);
}
// Mark the field as dirty so the change is saved
formContext.getAttribute("youtube_versionnumber").setSubmitMode("always");
}
💡Replace youtube_versionnumber with your own column schema name.
This technique was built as part of a full Contract Management System tutorial. If you want to see the full system being built from scratch the link is below.
📌 Contract Management System Full Tutorial: • Build a Contract Management System in Powe...
Auf dieser Seite können Sie das Online-Video This JavaScript Trick Automatically Versions Your Documents in Power Apps mit der Dauer stunde minuten sekunde in guter Qualität ansehen, das der Benutzer Steven Thawe 07 Juni 2026 hochgeladen hat, den Link mit Freunden und Bekannten teilen, dieses Video wurde auf Youtube bereits 130 Mal angesehen und es wurde von 7 den Zuschauern gefallen. Viel Spaß beim Betrachtenden Zuschauern gefallen!