All Apps and Add-ons

Help with ValueSetter

zzczar
New Member

I am looking for some help with using a search result value to set a $foo$ token value.

I have a search result that will return a value, field1, that I would like to pass to other views as a $foo$ token.

I am able to reference and display this field within the current view:

<module name="HTML" layoutPanel="panel_row1_col1">
  <param name="html">
    Value of field1: $results[0].field1$
  </param>
</module>

However, I am not able to get this value inside the ValueSetter module.

<module name="ValueSetter">
  <param name="urlEncodeKeys">field1</param>
  <param name="name">url_encoded_keys</param>
  <param name="value">field1=$results[0].field1$</param>
  <module name="HTML" layoutPanel="panel_row2_col1">
    <param name="html">
      Go to &lt;a href="tmp_target1?$url_encoded_keys$"&gt;Target 1&lt;/a&gt;.&lt;br&gt;
      &lt;br&gt;
      Go to &lt;a href="tmp_target2?$url_encoded_keys$"&gt;Target 2&lt;/a&gt;.&lt;br&gt;
    </param>
  </module>
</module>

This url ends up: ..\tmp_target1?field1=

I tried to use $results[0].field.rawValue$, but this did not help.

Is there a better way (or any way) to accomplish this?

I appreciate any help or guidance.

Thanks

0 Karma
1 Solution

sideview
SplunkTrust
SplunkTrust

What you're looking for, is the ResultsValueSetter module. Which is a strange little module that can basically reach into the search results, pull one or more field values out of the first row of those results, and make those field values available as straight-up $fieldName$ tokens downstream.

Note that the $results[0].fieldName$ syntax that you're using is a syntax that is only within the HTML module. That syntax is not supported anywhere outside the HTML module.

Anyway, here's what you need. You still need the ValueSetter to urlEncode the key, but now the ResultsValueSetter will make your field available to it, simply as $field1$.

<module name="ResultsValueSetter">
  <param name="fields">field1</param>

  <module name="ValueSetter">
    <param name="name">url_encoded_keys</param>
    <param name="value">field1=$field1$</param>
    <param name="urlEncodeKeys">field1</param>

    <module name="HTML" layoutPanel="panel_row2_col1">
      <param name="html">
        Go to &lt;a href="tmp_target1?$url_encoded_keys$"&gt;Target 1&lt;/a&gt;.&lt;br&gt;
        &lt;br&gt;
        Go to &lt;a href="tmp_target2?$url_encoded_keys$"&gt;Target 2&lt;/a&gt;.&lt;br&gt;
      </param>
    </module>
  </module>
 </module>

Also I'm sorry for the delay answering. If you add the 'Sideview Utils' app tag, then i get a little notification, or just contact me directly. If you post here without the tag then I don't see it until I go on big sweeps to catch unanswered questions (like now)

View solution in original post

sideview
SplunkTrust
SplunkTrust

What you're looking for, is the ResultsValueSetter module. Which is a strange little module that can basically reach into the search results, pull one or more field values out of the first row of those results, and make those field values available as straight-up $fieldName$ tokens downstream.

Note that the $results[0].fieldName$ syntax that you're using is a syntax that is only within the HTML module. That syntax is not supported anywhere outside the HTML module.

Anyway, here's what you need. You still need the ValueSetter to urlEncode the key, but now the ResultsValueSetter will make your field available to it, simply as $field1$.

<module name="ResultsValueSetter">
  <param name="fields">field1</param>

  <module name="ValueSetter">
    <param name="name">url_encoded_keys</param>
    <param name="value">field1=$field1$</param>
    <param name="urlEncodeKeys">field1</param>

    <module name="HTML" layoutPanel="panel_row2_col1">
      <param name="html">
        Go to &lt;a href="tmp_target1?$url_encoded_keys$"&gt;Target 1&lt;/a&gt;.&lt;br&gt;
        &lt;br&gt;
        Go to &lt;a href="tmp_target2?$url_encoded_keys$"&gt;Target 2&lt;/a&gt;.&lt;br&gt;
      </param>
    </module>
  </module>
 </module>

Also I'm sorry for the delay answering. If you add the 'Sideview Utils' app tag, then i get a little notification, or just contact me directly. If you post here without the tag then I don't see it until I go on big sweeps to catch unanswered questions (like now)

zzczar
New Member

Nick,

Perfect! Exactly what I needed. Many thanks.

0 Karma
Got questions? Get answers!

Join the Splunk Community Slack to learn, troubleshoot, and make connections with fellow Splunk practitioners in real time!

Meet up IRL or virtually!

Join Splunk User Groups to connect and learn in-person by region or remotely by topic or industry.

Get Updates on the Splunk Community!

Monitoring AI Agents with Splunk Observability Cloud

Let’s say I’m running a travel planning AI app in production. A user asks for three concise hotel options in ...

[Puzzles] Solve, Learn, Repeat: Tiling

This puzzle (first published here) is based on finding groups of tessellated tiles (inspired by floor tiles I ...

SOK it to Me: Top 3 Benefits of Using Splunk Operator on Kubernetes that’ll Make ...

    Thursday, July 9, 2026  |  11:00AM–12:00PM PDT Duration: 1 hour (includes Q&A) Managing can feel like a ...