Save and load dashboard filter widget bindings
Builds on #32229.
What
Load and save widget bindings through the dashboard layout API. One Reporting period filter can map to different date fields on different widgets, such as Close date on Opportunities and Due date on Tasks.
How
- Read the bindings with
PageLayout.filters, use the workspace cache index to look them up by filter, and save them with the rest of the layout in the same workspace migration. - Omit
bindingsto keep the saved mappings. Send an empty list to clear them. - Save bindings by filter and widget. The server assigns a binding ID on creation. Updates to an existing binding reuse its ID, and clients can save a new widget and its binding together using the widget ID.
- Check that each new or changed binding targets an active chart or record table and a date field on its object. When a widget edit or reactivation makes a saved binding incompatible, switch it off in the same migration, including during app updates. The filter remains available for its other widgets.
- Use the layout’s existing permissions and dashboard filters flag.
The automatic switch-off runs as a metadata side effect on widget updates (pageLayoutWidgetFilterBindingsOnUpdate), so the migration build orchestrator and the flat entity maps service stay generic. The handler reads the widget's final state together with the tab, filter and field changes in the same migration, and leaves any binding the caller changes in that migration to the builder. This lets a replacement supplied in the same save take effect and puts any automatic disable in the same transaction.
Side-effect handlers now receive the workspace custom application identifier, so the disable is recorded as a workspace override and an app-owned binding keeps its manifest value. App updates need no dedicated dependency lookup: the generic one already covers a binding once it is part of the migration.
Applying the date range to widget queries and adding the dashboard editor are follow-ups.
Testing
Passed 14 focused integration tests for dashboard saves and app-manifest updates, plus 23 unit tests for binding validation and the side effect. Coverage includes reactivation, saving with or without sending an existing binding, switching a widget's object together with its date field in one save, and keeping the binding off when a widget returns to its original object.
Generated by Claude Code