Help with dynamic content block for dashboard
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎02-03-2024 10:56 AM
All,
I have a dashboard that uses a dynamic content block to filter various reports on the dashboard.
My trigger right now, is the short description of the feature. I'm able to display the features in the content block, which is goodness.
What I need to do is display the short description but pull back the parent (enhancement or epic) associated with the feature and use that in my report filtering.
Here's a screenshot of the dashboard content block:
The above choices are the two features I want to use for filtering but I don't want to search by the short description of the feature, I want to search by the parent of the feature selected.
Here is my dynamic content block code:
<?xml version="1.0" encoding="UTF-8"?>
<j:jelly xmlns:j="jelly:core" xmlns:g="glide" xmlns:g2="null" xmlns:j2="null" trim="false">
<script>
var my_dashboardMessageHandler = new DashboardMessageHandler("my_unique_id");
function publishMultipleFilter(searchTerm) {
<!-- Mutliple filters can be passed as an array -->
var finalFilter = [
{"table":"sn_safe_feature","filter":"short_descriptionLIKE"+searchTerm},
{"table":"sn_safe_epics_realted_to_features","filter":"feature_short_descriptionLIKE"+searchTerm},
{"table":"sn_safe_enhancements_to_features","filter":"feat_short_descriptionLIKE"+searchTerm},
{"table":"sn_safe_scrum_task","filter":"sn_safe_story.sn_safe_feature.short_descriptionLIKE" +searchTerm}
];
<!-- call setDefaultValue first -->
SNC.canvas.interactiveFilters.setDefaultValue({
id: my_dashboardMessageHandler._unique_id,
filters: finalFilter,
}, false);
<!-- then call Publishmessage to publish filters-->
my_dashboardMessageHandler.publishMessage(finalFilter);
}
function clearFilter() {
SNC.canvas.interactiveFilters.removeDefaultValue(my_dashboardMessageHandler._unique_id, false);
my_dashboardMessageHandler.removeFilter();
}
</script>
<!-- <input id="searchTerm" type="text" class="form-control" value="" size="20" onchange="publishMultipleFilter(this.value);"></input> -->
<!--the eval below gets the design doc features -->
<g:evaluate>
var obj = [];
var gr= new GlideRecord('sn_safe_feature');
gr.addQuery('u_design_document_feature',true);
gr.query();
gs.info('MM count: ' + gr.getRowCount());
while(gr.next()) {
obj.push(gr.getDisplayValue());
}
</g:evaluate>
.
<select id="searchTerm" type="text" class="form-control" value="" style="width: 450px;" onchange="publishMultipleFilter(this.value);">
<option value="">All</option>
<j:forEach var="jvar_choice" items="${obj}">
<option value="${jvar_choice}">${jvar_choice}</option>
</j:forEach>
</select>
</j:jelly>
Any and all help is greatly appreciated