Hi there,
Im trying to make my JS button delete records from the KV store by key id. I can see it grabbing the token in the URL but it doesnt actually delete it. I copied it from the dev tutorial and ammended it a bit - im also only using XML.
JS :
require(
[
'jquery',
'splunkjs/mvc',
'splunkjs/mvc/tokenutils',
'splunkjs/mvc/searchmanager',
'splunkjs/mvc/savedsearchmanager',
'splunkjs/mvc/simplexml/urltokenmodel',
'splunkjs/mvc/postprocessmanager'
],
function ($, mvc,TokenUtils,SearchManager,SavedSearchManager,UrlTokenModel,PostProcessManager) {
// Delete Button Ref
const delete_config_button = $(``);
// Place it
$('.dashboard-form-globalfieldset').append(delete_config_button);
// Delete Button
$("#deleteRecordButton").click(function() {
// Get the value of the key ID field
var tokens = mvc.Components.get("default");
var form_keyid = tokens.get("KeyID");
// Delete the record that corresponds to the key ID using
// the del method to send a DELETE request
// to the storage/collections/data/{collection}/ endpoint
service.del("storage/collections/data/dashboard_input_settings/" + encodeURIComponent(form_keyid))
});
});
- Any thoughts on why this isnt working?
- Is there a way to make it refresh my table, without using JS savedsearch manager?
Thanks!
↧