<?xml version="1.0" encoding="UTF-8"?>
<rss xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#" xmlns:taxo="http://purl.org/rss/1.0/modules/taxonomy/" version="2.0">
  <channel>
    <title>topic Re: script in Dashboards &amp; Visualizations</title>
    <link>https://community.splunk.com/t5/Dashboards-Visualizations/script/m-p/748226#M58833</link>
    <description>&lt;P&gt;Hi&amp;nbsp;&lt;a href="https://community.splunk.com/t5/user/viewprofilepage/user-id/274807"&gt;@SN1&lt;/a&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I would start by adding a console.log(rowKey); and also one after&amp;nbsp;searchQuery - console.log(searchQuery);&lt;/P&gt;&lt;P&gt;and then validate that these are outputting what you expect.&lt;/P&gt;&lt;P&gt;Can you check to see if this prints out what you are expecting and let us know how you get on as this might help drill down further.&lt;/P&gt;&lt;P&gt;&lt;span class="lia-unicode-emoji" title=":glowing_star:"&gt;🌟&lt;/span&gt;&lt;SPAN&gt;&amp;nbsp;&lt;/SPAN&gt;&lt;STRONG&gt;Did this answer help you?&lt;/STRONG&gt;&lt;SPAN&gt;&amp;nbsp;&lt;/SPAN&gt;If so, please consider:&lt;/P&gt;&lt;UL&gt;&lt;LI&gt;Adding karma to show it was useful&lt;/LI&gt;&lt;LI&gt;Marking it as the solution if it resolved your issue&lt;/LI&gt;&lt;LI&gt;Commenting if you need any clarification&lt;/LI&gt;&lt;/UL&gt;&lt;P&gt;Your feedback encourages the volunteers in this community to continue contributing&lt;/P&gt;</description>
    <pubDate>Wed, 18 Jun 2025 12:01:38 GMT</pubDate>
    <dc:creator>livehybrid</dc:creator>
    <dc:date>2025-06-18T12:01:38Z</dc:date>
    <item>
      <title>script</title>
      <link>https://community.splunk.com/t5/Dashboards-Visualizations/script/m-p/748182#M58820</link>
      <description>&lt;P&gt;So I am using this script , what this script does it it creates a solved button on each field of dashboard drilldown and when that button it clicked it changes the value of solved field to 1 from 0 . I wan to know whats wrong in this script button can be seen but when it is clicked nothing happens even if i refresh the drilldown.&lt;BR /&gt;&lt;BR /&gt;This is the drilldown with the button in rowKey field.&lt;/P&gt;&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="SN1_0-1750221054876.png" style="width: 775px;"&gt;&lt;img src="https://community.splunk.com/t5/image/serverpage/image-id/39400i032BD286816C4C33/image-dimensions/775x183?v=v2" width="775" height="183" role="button" title="SN1_0-1750221054876.png" alt="SN1_0-1750221054876.png" /&gt;&lt;span class="lia-inline-image-caption" onclick="event.preventDefault();"&gt;SN1_0-1750221054876.png&lt;/span&gt;&lt;/span&gt;&lt;/P&gt;&lt;P&gt;&lt;BR /&gt;This is the script.&lt;BR /&gt;&lt;BR /&gt;&lt;/P&gt;&lt;LI-CODE lang="markup"&gt;require([
'splunkjs/mvc',
'splunkjs/mvc/searchmanager',
'splunkjs/mvc/tableview',
'splunkjs/mvc/simplexml/ready!',
'jquery'
], function(mvc, SearchManager, TableView, ignored, $) {

// Define a simple cell renderer with a button
var ActionButtonRenderer = TableView.BaseCellRenderer.extend({
canRender: function(cell) {
return cell.field === 'rowKey';
},
render: function($td, cell) {
$td.addClass('button-cell');


var rowKey = cell.value
var $btn = $('&amp;lt;button class="btn btn-success"&amp;gt;Mark Solved&amp;lt;/button&amp;gt;');

$btn.on('click', function(e) {
e.preventDefault();
e.stopPropagation();

var searchQuery = `| inputlookup sbc_warning.csv
| eval rowKey=tostring(rowKey)
| eval solved=if(rowKey="${rowKey}", "1", solved)
| outputlookup sbc_warning.csv`;

var writeSearch = new SearchManager({
id: "writeSearch_" + Math.floor(Math.random() * 100000),
search: searchQuery,
autostart: true
});

writeSearch.on('search:done', function() {
console.log("Search completed and lookup updated");
var panelSearch = mvc.Components.get('panel_search_id');
if (panelSearch) {
panelSearch.startSearch();
console.log("Panel search restarted");
}
});
});

$td.append($btn);
}
});

// Apply the renderer to the specified table
var tableComponent = mvc.Components.get('sbc_alarm_table');
if (tableComponent) {
tableComponent.getVisualization(function(tableView) {
tableView.table.addCellRenderer(new ActionButtonRenderer());
tableView.table.render();
});
}
});&lt;/LI-CODE&gt;</description>
      <pubDate>Wed, 18 Jun 2025 11:54:08 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Dashboards-Visualizations/script/m-p/748182#M58820</guid>
      <dc:creator>SN1</dc:creator>
      <dc:date>2025-06-18T11:54:08Z</dc:date>
    </item>
    <item>
      <title>Re: script</title>
      <link>https://community.splunk.com/t5/Dashboards-Visualizations/script/m-p/748226#M58833</link>
      <description>&lt;P&gt;Hi&amp;nbsp;&lt;a href="https://community.splunk.com/t5/user/viewprofilepage/user-id/274807"&gt;@SN1&lt;/a&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I would start by adding a console.log(rowKey); and also one after&amp;nbsp;searchQuery - console.log(searchQuery);&lt;/P&gt;&lt;P&gt;and then validate that these are outputting what you expect.&lt;/P&gt;&lt;P&gt;Can you check to see if this prints out what you are expecting and let us know how you get on as this might help drill down further.&lt;/P&gt;&lt;P&gt;&lt;span class="lia-unicode-emoji" title=":glowing_star:"&gt;🌟&lt;/span&gt;&lt;SPAN&gt;&amp;nbsp;&lt;/SPAN&gt;&lt;STRONG&gt;Did this answer help you?&lt;/STRONG&gt;&lt;SPAN&gt;&amp;nbsp;&lt;/SPAN&gt;If so, please consider:&lt;/P&gt;&lt;UL&gt;&lt;LI&gt;Adding karma to show it was useful&lt;/LI&gt;&lt;LI&gt;Marking it as the solution if it resolved your issue&lt;/LI&gt;&lt;LI&gt;Commenting if you need any clarification&lt;/LI&gt;&lt;/UL&gt;&lt;P&gt;Your feedback encourages the volunteers in this community to continue contributing&lt;/P&gt;</description>
      <pubDate>Wed, 18 Jun 2025 12:01:38 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Dashboards-Visualizations/script/m-p/748226#M58833</guid>
      <dc:creator>livehybrid</dc:creator>
      <dc:date>2025-06-18T12:01:38Z</dc:date>
    </item>
  </channel>
</rss>

