Citizen Developer
Timespan
explore our new search
​
Power Apps Timer: Improve Performance
Power Apps
Oct 21, 2025 5:52 PM

Power Apps Timer: Improve Performance

by HubSite 365 about Pragmatic Works

Power Apps timer guide using Dataverse and Power Fx with JavaScript for precise millisecond logging and persistence

Key insights

  • Timer control limits in model-driven apps are replaced by command bar JavaScript so timers can start and stop per record without relying on the built-in control.
    The video shows how this approach gives precise control and avoids UI timer restrictions.
  • Wire up Begin/Stop buttons in the modern command designer and route them to a JavaScript library that accepts the primaryControl parameter.
    This lets commands act on the current record and keeps logic consistent across form navigation.
  • Persist timer state in browser storage so a timer survives tab changes and page reloads.
    The solution records elapsed time with milliseconds accuracy to maintain precise timing across sessions.
  • Only write elapsed time to Dataverse when a timer completes, preventing partial or "half-done" records.
    The video demonstrates logging exact elapsed milliseconds and updating the record only on completion.
  • Roll up elapsed minutes to a dedicated field and apply clear rounding rules to aggregate time consistently.
    The workflow shows how to sum intervals and store totals for reporting and business logic.
  • Include safeguards on the Stop action to prevent duplicate writes and to handle unexpected reloads.
    The episode ends with a challenge to add Pause and Cancel features for a fuller timer experience and better UX.

Overview: What the Video Covers

The YouTube video by Pragmatic Works demonstrates how to make a model-driven app behave like it has a true Timer by replacing built-in control limits with custom commands. First, the presenters show how to add Start and Stop actions to the modern command bar, then they explain how to preserve timer state in the browser and capture precise elapsed time. Consequently, the approach avoids creating incomplete records by writing elapsed milliseconds to Dataverse only when a timer completes. Overall, the demo targets makers who need accurate timing without relying on the basic control’s constraints.

How the Start/Stop Mechanism Works

In the video, the team wires Begin and Stop buttons to JavaScript library functions that accept the page context (the primaryControl parameter) and control a record-scoped timer. Then, they illustrate how command bar commands call these functions from the modern designer so the timer runs independently of the built-in control limits. As a result, users can start timing a record from the command bar and stop it reliably even if they navigate between tabs. This separation of UI action and timing logic gives makers more control and flexibility.

Moreover, the presenters emphasize safe button behavior by adding safeguards to prevent duplicate starts or accidental stops while publishing changes and refreshing the page. Next, they show how the Stop action performs final validation before persisting a result, ensuring only fully completed sessions become records. Therefore, the app reduces noise in the database and prevents half-finished timer entries. These steps help teams keep data clean and reliable for reporting or billing.

Persisting State and Ensuring Accuracy

The video also tackles state persistence, explaining how to store timer state in the browser so a timer survives tab changes and reloads. For accuracy, they log elapsed time in milliseconds and only write that value to Dataverse when the timer completes, which preserves precise timing for downstream calculations. Consequently, the approach minimizes database writes while keeping a highly accurate record of work durations. This pattern suits scenarios like time tracking, audits, or SLA measurement where precision matters.

In addition, the presenters discuss handling page reloads and cross-tab navigation by restoring timer state from browser storage and resuming elapsed calculations in memory. However, they note that browser persistence comes with limits, such as user privacy settings, local storage quotas, and behavior across different browsers and devices. Therefore, makers should test across environments and plan fallback behavior for unsupported cases. Ultimately, careful handling ensures timers remain usable in common real-world scenarios.

Data Handling: Logging, Roll-ups, and Rounding

Next, the demo shows how to roll up elapsed minutes to a field and apply rounding rules that suit reporting needs. For example, they explain strategies for rounding to the nearest minute or keeping fractional minutes depending on billing or analytics requirements. Consequently, teams must weigh precision against storage and calculation simplicity because storing milliseconds yields accuracy but can complicate aggregated reporting. Therefore, designers should choose a schema that balances detail and usability for their stakeholders.

Then, the presenters describe how to avoid cluttering the database by writing only completed timers to Dataverse, leaving partial sessions out of final records. However, this choice means recovering or resuming half-finished work requires careful UX decisions and potentially temporary storage. In contrast, persisting every state change simplifies recovery but increases write volume and storage costs, particularly at scale. Thus, the video frames a clear tradeoff between data hygiene and recoverability.

Tradeoffs, Challenges, and the Pause/Cancel Opportunity

Finally, the video compares using Power Fx and declarative features versus custom JavaScript for command bar logic, highlighting tradeoffs in maintainability, security, and capability. While Power Fx can simplify development and keep makers within platform boundaries, JavaScript unlocks finer control, millisecond precision, and richer browser interactions, albeit with higher maintenance and governance needs. Therefore, teams must balance the need for precision against their capacity to manage pro-code assets and comply with security policies.

As a challenge, the presenters invite viewers to implement Pause and Cancel features, which introduces more complexity like state transitions, accumulated elapsed time, and clear UX feedback. Moreover, adding pause/resume behavior raises questions about where to store interim state, how to handle concurrent edits, and how to reflect paused time in roll-ups. In short, the demo from Pragmatic Works gives a practical, reproducible path for improving timing behavior while also clarifying the tradeoffs involved. Consequently, makers can adopt the pattern or adapt parts of it depending on their scale, compliance needs, and the user experience they want to deliver.

Power Apps - Power Apps Timer: Improve Performance

Keywords

Power Apps timer optimization, improve Power Apps timer, Power Apps timer best practices, Power Apps timer performance, advanced Power Apps timer techniques, low-code Power Apps timer tips, Power Apps timer debounce and throttling, Power Apps timer accuracy troubleshooting