Business
Jobs
  • About Us
  • Solutions
    • Job Postings
      Post your job and receive qualified candidates in 48h.
    • Candidate Assessments
      500+ technical and psychological tests, plus anti-fraud.
    • Headhunting
      Tailor-made executive search from start to finish.
    • Payroll + EOR
      Payroll dispersal and EOR across 15+ LATAM countries.
  • Pricing
  • Jobs

0

204
Views
How to get variable out from the Splunk mvc.createService().get() function?

sorry for posting this, but I need some help and another pair of eyes. I must admit that everything that I have found here on stackoverflow, splunk docs and splunk community answers, and of course tried, it failed on me.

What I want to achieve is to read from a custom config file (file details below) and get that result out to be used in other part of the code for a double check.

Conf file details: name config.conf, the stanza is named download, the property is called version which may have value of new or old.

The code is:

define(["jquery", "react", "splunkjs/mvc", "splunkjs/splunk"], function ($, react, mvc, splunk_js_sdk) {
  
  const e = react.createElement;
  const useEffect = react.useEffect;

  // Get version from conf file
  var version;
  mvc.createService().get("/servicesNS/-/my_app/properties/config/download", {}, function (err, response) {
    if (err) {
      console.log("Error:" + err);
      return;
    } else {
      version = response.data.entry[0].content;
      console.log("Version from conf: " + version);
    }
    return version
  });
...........Rest of the code (React)..........
});

...which works and displays the version in the console.log Version from conf: old inside function, but my real issue (which I am not able to see it) is that I am not able to figure it how to get out that result into a variable, for example:

var version = old

This looks like an asynchronous function with a promise (not sure) but my knowledge (I must admit) is not so great in this area.

I have found my inspiration from here and I have adjusted a bit for my needs.

In the end I am thanking in advance to anyone who will shed a bit of light for me here.

Thank you, George

about 4 years ago · Juan Pablo Isaza
Answer question
Find remote jobs

Discover the new way to find a job!

Top jobs
Top job categories
Business
Post vacancy Pricing Sales
Legal
Terms and conditions Privacy policy
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Show me some job opportunities
There's an error!