Hi everyone,
I'm working on a customization in Dynamics 365 CRM and could use some help with a tagging and filtering scenario.
Here’s the setup:
There's a custom button in the ribbon that opens a dialog window allowing users to select one or more tags.
Tags are a separate entity connected to the main records through an N:N relationship.
There's also a view displaying a list of these main records.
Goal:
When a user selects a tag from the dialog, I want to:
Dynamically filter the records in the current view to show only those that are linked to the selected tag.
Optionally, display the selected tag somewhere in the view (for visual context).
Has anyone implemented something similar or can suggest an approach to dynamically apply a filter to a view based on tag selection from a custom dialog?
Any advice, ideas, or examples would be greatly appreciated!
Hi,
To dynamically filter a view in Dynamics 365 CRM based on N:N tag selection from a ribbon dialog, you’ll need to combine JavaScript customization, Ribbon Workbench, and Web API calls. Here's a recommended approach based on best practices and community solutions:
Xrm.WebApi.retrieveMultipleRecords
method to fetch records linked to the selected tags and then refresh the grid with those records.Example logic:
function filterRecordsByTags(selectedTagIds) {
// Build FetchXML or Web API query to get records linked to selected tags
// Update the subgrid or view with filtered results
}
Please verify if this approach aligns with your scenario or if you'd like help implementing specific parts of the solution.
Thanks and best regards,\
Daniele\
Note: This response was prepared with support from Copilot to ensure clarity and completeness.
[2]: https://www.itaintboring.com/dynamics-crm/filtered-nn-lookup/\
[3]: https://xrmdynamicscrm.wordpress.com/2020/06/07/dynamics-365-sub-grid-add-existing-look-up-view-nn/\
[1]: https://blog.magnetismsolutions.com/blog/paulnieuwelaar/2018/05/17/filter-n-n-add-existing-lookup-dynamics-365-v9-supported-code