<?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>question Dynamically update variable instructions in Developer forum</title>
    <link>https://www.servicenow.com/community/developer-forum/dynamically-update-variable-instructions/m-p/2201774#M857148</link>
    <description>&lt;P&gt;Hi All,&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Is there a way to dynamically update catalog variable instructions in a service portal.&lt;/P&gt;&lt;P&gt;I've created a variable set that includes a manager variable, and for 80% of my items it will have the instruction "Line manger of user"&lt;/P&gt;&lt;P&gt;However for the other 20% the text should read "Authorising manager".&lt;/P&gt;&lt;P&gt;I know I could create the variables for each item but I was hoping for a more elegant solution.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Thanks&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;William&lt;/P&gt;</description>
    <pubDate>Thu, 08 Dec 2016 16:45:03 GMT</pubDate>
    <dc:creator>W Fortune1</dc:creator>
    <dc:date>2016-12-08T16:45:03Z</dc:date>
    <item>
      <title>Dynamically update variable instructions</title>
      <link>https://www.servicenow.com/community/developer-forum/dynamically-update-variable-instructions/m-p/2201774#M857148</link>
      <description>&lt;P&gt;Hi All,&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Is there a way to dynamically update catalog variable instructions in a service portal.&lt;/P&gt;&lt;P&gt;I've created a variable set that includes a manager variable, and for 80% of my items it will have the instruction "Line manger of user"&lt;/P&gt;&lt;P&gt;However for the other 20% the text should read "Authorising manager".&lt;/P&gt;&lt;P&gt;I know I could create the variables for each item but I was hoping for a more elegant solution.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Thanks&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;William&lt;/P&gt;</description>
      <pubDate>Thu, 08 Dec 2016 16:45:03 GMT</pubDate>
      <guid>https://www.servicenow.com/community/developer-forum/dynamically-update-variable-instructions/m-p/2201774#M857148</guid>
      <dc:creator>W Fortune1</dc:creator>
      <dc:date>2016-12-08T16:45:03Z</dc:date>
    </item>
    <item>
      <title>Re: Dynamically update variable instructions</title>
      <link>https://www.servicenow.com/community/developer-forum/dynamically-update-variable-instructions/m-p/2201775#M857149</link>
      <description>&lt;P&gt;I'm not entirely sure there's enough information to answer you but in general yes you can set a variable value dynamically. You can write a script to set the field value based on another value or parameter. &lt;/P&gt;&lt;BR /&gt;</description>
      <pubDate>Thu, 08 Dec 2016 16:58:05 GMT</pubDate>
      <guid>https://www.servicenow.com/community/developer-forum/dynamically-update-variable-instructions/m-p/2201775#M857149</guid>
      <dc:creator>davidpanson</dc:creator>
      <dc:date>2016-12-08T16:58:05Z</dc:date>
    </item>
    <item>
      <title>Re: Dynamically update variable instructions</title>
      <link>https://www.servicenow.com/community/developer-forum/dynamically-update-variable-instructions/m-p/2201776#M857150</link>
      <description>&lt;P&gt;Thanks for the reply but It's not the value I want to change but the instructions.&lt;/P&gt;&lt;BR /&gt;&lt;P&gt;&lt;/P&gt;&lt;BR /&gt;&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper" image-alt="find_real_file.png"&gt;&lt;img src="https://www.servicenow.com/community/image/serverpage/image-id/82813i19925909089F677B/image-size/large?v=v2&amp;amp;px=999" role="button" title="find_real_file.png" alt="find_real_file.png" /&gt;&lt;/span&gt;&lt;/P&gt;&lt;BR /&gt;</description>
      <pubDate>Thu, 08 Dec 2016 17:01:58 GMT</pubDate>
      <guid>https://www.servicenow.com/community/developer-forum/dynamically-update-variable-instructions/m-p/2201776#M857150</guid>
      <dc:creator>W Fortune1</dc:creator>
      <dc:date>2016-12-08T17:01:58Z</dc:date>
    </item>
    <item>
      <title>Re: Dynamically update variable instructions</title>
      <link>https://www.servicenow.com/community/developer-forum/dynamically-update-variable-instructions/m-p/2201777#M857151</link>
      <description>&lt;P&gt;Oh my mistake. Try checking out these links. I think they may be helpful.&lt;/P&gt;&lt;BR /&gt;&lt;P&gt;&lt;/P&gt;&lt;BR /&gt;&lt;P&gt;&lt;A title="How to set default value as a current month value in a variable on catalog form ." __default_attr="181324" __jive_macro_name="thread" class="jive_macro_thread jive_macro" data-orig-content="How to set default value as a current month value in a variable on catalog form ." data-renderedposition="52_8_525_16" href="https://www.servicenow.com/community?id=community_question&amp;amp;sys_id=058d832ddb9cdbc01dcaf3231f9619f0"&gt;How to set default value as a current month value in a variable on catalog form .&lt;/A&gt; &lt;/P&gt;&lt;BR /&gt;&lt;P&gt;&lt;A href="https://docs.servicenow.com/bundle/istanbul-servicenow-platform/page/administer/core-configuration/topic/p_FormAdministration.html" title="https://docs.servicenow.com/bundle/istanbul-servicenow-platform/page/administer/core-configuration/topic/p_FormAdministration.html"&gt;Form administration&lt;/A&gt; &lt;/P&gt;&lt;BR /&gt;</description>
      <pubDate>Thu, 08 Dec 2016 17:20:29 GMT</pubDate>
      <guid>https://www.servicenow.com/community/developer-forum/dynamically-update-variable-instructions/m-p/2201777#M857151</guid>
      <dc:creator>davidpanson</dc:creator>
      <dc:date>2016-12-08T17:20:29Z</dc:date>
    </item>
    <item>
      <title>Re: Dynamically update variable instructions</title>
      <link>https://www.servicenow.com/community/developer-forum/dynamically-update-variable-instructions/m-p/2201778#M857152</link>
      <description>&lt;P&gt;Thanks again but I had already looked through those links without finding the answer.&lt;/P&gt;&lt;BR /&gt;&lt;P&gt;It's not on the form but in the service portal on a widget. I'm able to update the value and the label of a variable dynamically and I was hoping for a similar method for the instructions. &lt;/P&gt;&lt;BR /&gt;</description>
      <pubDate>Fri, 09 Dec 2016 08:38:46 GMT</pubDate>
      <guid>https://www.servicenow.com/community/developer-forum/dynamically-update-variable-instructions/m-p/2201778#M857152</guid>
      <dc:creator>W Fortune1</dc:creator>
      <dc:date>2016-12-09T08:38:46Z</dc:date>
    </item>
    <item>
      <title>Re: Dynamically update variable instructions</title>
      <link>https://www.servicenow.com/community/developer-forum/dynamically-update-variable-instructions/m-p/2601388#M1011957</link>
      <description>&lt;P&gt;&lt;a href="https://www.servicenow.com/community/user/viewprofilepage/user-id/268613"&gt;@W Fortune1&lt;/a&gt;&amp;nbsp;Did you find an answer in the last 7 years?&amp;nbsp; : )&lt;/P&gt;</description>
      <pubDate>Thu, 29 Jun 2023 13:29:47 GMT</pubDate>
      <guid>https://www.servicenow.com/community/developer-forum/dynamically-update-variable-instructions/m-p/2601388#M1011957</guid>
      <dc:creator>G24</dc:creator>
      <dc:date>2023-06-29T13:29:47Z</dc:date>
    </item>
    <item>
      <title>Re: Dynamically update variable instructions</title>
      <link>https://www.servicenow.com/community/developer-forum/dynamically-update-variable-instructions/m-p/2601495#M1011991</link>
      <description>&lt;P&gt;Yes, there is a way.&amp;nbsp; Here it is:&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;LI-CODE lang="javascript"&gt;function onLoad() {
    var myField = g_form.getField("u_sd_location"); //getField works in portal only, not Platform UI.
	
	var myInstructions = 
		"My Happy Instruction Text. " + "For more help, please read the [AnchorTag]";
	
	//Build a URL that includes the URI of the Current Instance (dev, test, prod), and also a link to the Portal knowledge article.
	var fullURL = "[instanceURI][pagePath][article_id]";
	//var instanceURI = gs.getProperty('glide.servlet.uri'); //Works in Server-Side code only, not client-side Catalog Client Script code.
	var instanceURI = this.location.origin;
	var pagePath = "/kb_view.do?sysparm_article=";
	var kbNumber = "KB0010981";
	var anchorText = "Knowledge Article";

	fullURL = fullURL.replace("[instanceURI]", instanceURI);
	fullURL = fullURL.replace("[pagePath]", pagePath);
	fullURL = fullURL.replace("[article_id]", kbNumber);
	
	//Now wrap that URI in an HTML Anchor tag.
	var anchorTag = '&amp;lt;a href="[fullURL]" target="_blank"&amp;gt;[anchorText]&amp;lt;/a&amp;gt;';
	anchorTag = anchorTag.replace("[fullURL]", fullURL);
	anchorTag = anchorTag.replace("[anchorText]", anchorText);
	
	myInstructions = myInstructions.replace("[AnchorTag]", anchorTag);
	
	myField.instructions = myInstructions;
}&lt;/LI-CODE&gt;</description>
      <pubDate>Thu, 29 Jun 2023 15:01:09 GMT</pubDate>
      <guid>https://www.servicenow.com/community/developer-forum/dynamically-update-variable-instructions/m-p/2601495#M1011991</guid>
      <dc:creator>G24</dc:creator>
      <dc:date>2023-06-29T15:01:09Z</dc:date>
    </item>
    <item>
      <title>Re: Dynamically update variable instructions</title>
      <link>https://www.servicenow.com/community/developer-forum/dynamically-update-variable-instructions/m-p/3571771#M1259871</link>
      <description>&lt;P&gt;An alternative method is by using a Rich Text Label variable just above the variable you want the text to display for.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Perform the logic in an onLoad or onChange catalog client script, and use g_form.setLabelOf('your_label_variable', 'html_string') to update the label variable's value.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Note: you cannot use a rich text label in a multi row variable set.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;LI-CODE lang="javascript"&gt;function onLoad() {
     var LABEL_FIELD = "my_label_field_name";
     var text = "&amp;lt;p&amp;gt;Hello, World!&amp;lt;/p&amp;gt;"

     g_form.setLabelOf(LABEL_FIELD, text)
}&lt;/LI-CODE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Fri, 10 Jul 2026 10:06:18 GMT</pubDate>
      <guid>https://www.servicenow.com/community/developer-forum/dynamically-update-variable-instructions/m-p/3571771#M1259871</guid>
      <dc:creator>frankcoates</dc:creator>
      <dc:date>2026-07-10T10:06:18Z</dc:date>
    </item>
  </channel>
</rss>

