<?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 How to access global variable sets from a scoped application script in Servicenow in Developer forum</title>
    <link>https://www.servicenow.com/community/developer-forum/how-to-access-global-variable-sets-from-a-scoped-application/m-p/1597623#M254549</link>
    <description>&lt;P&gt;Hi All,&lt;BR /&gt;I am using an aws scoped application ( aws service management connector) and from the catalog I am trying to access some global variable sets. I am able to populate the catalog with the global variable sets however when I try to populate the value from the script to send it to aws, the value or display value is not getting retrieved.&lt;BR /&gt;&lt;BR /&gt;see below:&lt;BR /&gt;//Add custom Tags&lt;BR /&gt;var tags = [];&lt;BR /&gt;var reqFor = current.variables.req_for.getDisplayValue();// created in AWS scoped app&lt;BR /&gt;//var BusOwner = current.aws_business_owner.getDisplayValue(); // created on global..&lt;BR /&gt;//var busow = current.aws_business_owner.getDisplayValue();&lt;BR /&gt;var busow1 = current.variables.aws_business_owner;  // global variable and doesn't fetch data from the form&lt;BR /&gt;&lt;BR /&gt;if(current.variables.Tags)&lt;BR /&gt;	tags = JSON.parse("" + current.variables.Tags);&lt;BR /&gt;tags.push({&lt;BR /&gt;	Key: "Requested For",&lt;BR /&gt;	Value: reqFor   // works fine and populates the value&lt;BR /&gt;});&lt;BR /&gt;&lt;BR /&gt;tags.push({&lt;BR /&gt;	Key: "Division",&lt;BR /&gt;	Value: busow1   // gives null value. **** Need suggestions here *****&lt;BR /&gt;});&lt;BR /&gt;current.variables.Tags = JSON.stringify(tags);&lt;BR /&gt;&lt;BR /&gt;&lt;BR /&gt;output:&lt;BR /&gt;&lt;BR /&gt;"Key":"Environment","Value":"Development"},&lt;BR /&gt;{"Key":"Requested For","Value":"Ak Kostr"},&lt;BR /&gt;{"Key":"Division","Value":{}}]  //doesnt fetch any values for global variable from the form&lt;/P&gt;</description>
    <pubDate>Mon, 02 May 2022 15:09:03 GMT</pubDate>
    <dc:creator>Kishan Gourav</dc:creator>
    <dc:date>2022-05-02T15:09:03Z</dc:date>
    <item>
      <title>How to access global variable sets from a scoped application script in Servicenow</title>
      <link>https://www.servicenow.com/community/developer-forum/how-to-access-global-variable-sets-from-a-scoped-application/m-p/1597623#M254549</link>
      <description>&lt;P&gt;Hi All,&lt;BR /&gt;I am using an aws scoped application ( aws service management connector) and from the catalog I am trying to access some global variable sets. I am able to populate the catalog with the global variable sets however when I try to populate the value from the script to send it to aws, the value or display value is not getting retrieved.&lt;BR /&gt;&lt;BR /&gt;see below:&lt;BR /&gt;//Add custom Tags&lt;BR /&gt;var tags = [];&lt;BR /&gt;var reqFor = current.variables.req_for.getDisplayValue();// created in AWS scoped app&lt;BR /&gt;//var BusOwner = current.aws_business_owner.getDisplayValue(); // created on global..&lt;BR /&gt;//var busow = current.aws_business_owner.getDisplayValue();&lt;BR /&gt;var busow1 = current.variables.aws_business_owner;  // global variable and doesn't fetch data from the form&lt;BR /&gt;&lt;BR /&gt;if(current.variables.Tags)&lt;BR /&gt;	tags = JSON.parse("" + current.variables.Tags);&lt;BR /&gt;tags.push({&lt;BR /&gt;	Key: "Requested For",&lt;BR /&gt;	Value: reqFor   // works fine and populates the value&lt;BR /&gt;});&lt;BR /&gt;&lt;BR /&gt;tags.push({&lt;BR /&gt;	Key: "Division",&lt;BR /&gt;	Value: busow1   // gives null value. **** Need suggestions here *****&lt;BR /&gt;});&lt;BR /&gt;current.variables.Tags = JSON.stringify(tags);&lt;BR /&gt;&lt;BR /&gt;&lt;BR /&gt;output:&lt;BR /&gt;&lt;BR /&gt;"Key":"Environment","Value":"Development"},&lt;BR /&gt;{"Key":"Requested For","Value":"Ak Kostr"},&lt;BR /&gt;{"Key":"Division","Value":{}}]  //doesnt fetch any values for global variable from the form&lt;/P&gt;</description>
      <pubDate>Mon, 02 May 2022 15:09:03 GMT</pubDate>
      <guid>https://www.servicenow.com/community/developer-forum/how-to-access-global-variable-sets-from-a-scoped-application/m-p/1597623#M254549</guid>
      <dc:creator>Kishan Gourav</dc:creator>
      <dc:date>2022-05-02T15:09:03Z</dc:date>
    </item>
    <item>
      <title>Re: How to access global variable sets from a scoped application script in Servicenow</title>
      <link>https://www.servicenow.com/community/developer-forum/how-to-access-global-variable-sets-from-a-scoped-application/m-p/1597624#M254550</link>
      <description>&lt;P&gt;The scope of the variable set should not be an issue in and of itself - and you are positive that the variable in question has a value for the record being processed?&lt;/P&gt;
&lt;P&gt;A quick check you can make is to take an item you know has the right values and run a test in a background script, both in your application scope and in the global scope and see what the results are.&amp;nbsp;&lt;/P&gt;
&lt;PRE class="language-markup"&gt;&lt;CODE&gt;var sys_id = '&amp;lt;sys_id_of_a_good_record&amp;gt;'
var current = new GlideRecord('sc_req_item');
current.get(sys_id);

gs.info('Does it exist? ' + current.variables.aws_business_owner != undefined);
gs.info('Is there a value? ' + current.variables.aws_business_owner);
gs.info('Is there a display value? ' + current.variables.aws_business_owner.getDisplayValue());&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;I hope this helps!&lt;/P&gt;
&lt;P&gt;If this was helpful, or correct, please be kind and mark the answer appropriately.&lt;/P&gt;
&lt;P&gt;Michael Jones - Proud member of the GlideFast Consulting Team!&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Mon, 02 May 2022 16:19:29 GMT</pubDate>
      <guid>https://www.servicenow.com/community/developer-forum/how-to-access-global-variable-sets-from-a-scoped-application/m-p/1597624#M254550</guid>
      <dc:creator>Michael Jones -</dc:creator>
      <dc:date>2022-05-02T16:19:29Z</dc:date>
    </item>
  </channel>
</rss>

