<?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 Re: How to get catalog variable question and Selected value into email Notification (should support language) in Service Management forum</title>
    <link>https://www.servicenow.com/community/service-management-forum/how-to-get-catalog-variable-question-and-selected-value-into/m-p/370540#M1853</link>
    <description>&lt;P&gt;I don't know if this would work, but if a variable's getLabel method retains language it might.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;(function runMailScript(current, template, email, email_action, event) {&lt;/P&gt;
&lt;P&gt;&amp;nbsp; var ritm = new GlideRecord('sc_req_item');&lt;BR /&gt; &lt;BR /&gt;&amp;nbsp; ritm.get(/* YOUR RITM SYS_ID HERE */);&lt;BR /&gt; &lt;BR /&gt;&amp;nbsp; var variable_names = Object.keys(ritm.variables); // Get all the keys in the RITM's variables object&lt;BR /&gt; &lt;BR /&gt;&amp;nbsp; var string = '';&lt;BR /&gt; &lt;BR /&gt;&amp;nbsp; for (var index = 0; index &amp;lt; variable_names.length - 1; ++ index) {&lt;BR /&gt; &lt;BR /&gt;&amp;nbsp; &amp;nbsp; var variable = ritm.variables[variable_names[index]];&lt;BR /&gt; &lt;BR /&gt;&amp;nbsp; &amp;nbsp; string += variable.getLabel() + " " + variable.getDisplayValue() + "&amp;lt;br&amp;gt;"; // Get the label and display value of each variable&lt;BR /&gt; &lt;BR /&gt;&amp;nbsp; }&lt;BR /&gt; &lt;BR /&gt;&amp;nbsp; template.print(string);&lt;/P&gt;
&lt;P&gt;})(current, template, email, email_action, event);&lt;/P&gt;</description>
    <pubDate>Mon, 09 Mar 2020 17:46:46 GMT</pubDate>
    <dc:creator>userpoth1</dc:creator>
    <dc:date>2020-03-09T17:46:46Z</dc:date>
    <item>
      <title>How to get catalog variable question and Selected value into email Notification (should support language)</title>
      <link>https://www.servicenow.com/community/service-management-forum/how-to-get-catalog-variable-question-and-selected-value-into/m-p/370537#M1850</link>
      <description>&lt;P&gt;Hi All,&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;I need to send email notification to requestor with Catalog variable and selected label &amp;nbsp; &amp;nbsp; based on user language&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Example :&lt;/P&gt;&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper" image-alt="Screen Shot 2017-06-24 at 1.15.08 PM.png"&gt;&lt;img src="https://www.servicenow.com/community/image/serverpage/image-id/10169i169659BDA1B93B3E/image-size/large?v=v2&amp;amp;px=999" role="button" title="Screen Shot 2017-06-24 at 1.15.08 PM.png" alt="Screen Shot 2017-06-24 at 1.15.08 PM.png" /&gt;&lt;/span&gt;&lt;/P&gt;&lt;P&gt;Scripted used in email script :&lt;/P&gt;&lt;P&gt;// a is name of the catalog variable&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;function Name(a) {&lt;/P&gt;&lt;P&gt;var set = new GlideappVariablePoolQuestionSet();&lt;/P&gt;&lt;P&gt;set.setRequestID(current.sys_id);&lt;/P&gt;&lt;P&gt;set.load();&lt;/P&gt;&lt;P&gt;var vs = set.getFlatQuestions();&lt;/P&gt;&lt;P&gt;for (var i = 0; i &amp;lt; vs.size(); i++) {&lt;/P&gt;&lt;P&gt;if (vs.get(i).getName() == a) {&lt;/P&gt;&lt;P&gt;return vs.get(i).getLabel() + " = " + vs.get(i).getDisplayValue();&lt;/P&gt;&lt;P&gt;}&lt;/P&gt;&lt;P&gt;}&lt;/P&gt;&lt;P&gt;}&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;This script returns question and selected label but it is returning only english i need a script which can support every language . service catalog support &amp;nbsp; multiple language's.&lt;/P&gt;</description>
      <pubDate>Sat, 24 Jun 2017 17:16:58 GMT</pubDate>
      <guid>https://www.servicenow.com/community/service-management-forum/how-to-get-catalog-variable-question-and-selected-value-into/m-p/370537#M1850</guid>
      <dc:creator>sanju41</dc:creator>
      <dc:date>2017-06-24T17:16:58Z</dc:date>
    </item>
    <item>
      <title>Re: How to get catalog variable question and Selected value into email Notification (should support language)</title>
      <link>https://www.servicenow.com/community/service-management-forum/how-to-get-catalog-variable-question-and-selected-value-into/m-p/370538#M1851</link>
      <description>&lt;P&gt;Have you tried &amp;nbsp; "&lt;SPAN style="color: #666666; font-family: arial, sans-serif;"&gt;gs.getMessage(&lt;SPAN style="color: #666666; font-family: arial, sans-serif;"&gt;vs.get(i).getLabel()&lt;/SPAN&gt;);" &amp;nbsp; ?&lt;/SPAN&gt;&lt;/P&gt;&lt;BR /&gt;</description>
      <pubDate>Sat, 24 Jun 2017 18:04:40 GMT</pubDate>
      <guid>https://www.servicenow.com/community/service-management-forum/how-to-get-catalog-variable-question-and-selected-value-into/m-p/370538#M1851</guid>
      <dc:creator>chirag_bagdai</dc:creator>
      <dc:date>2017-06-24T18:04:40Z</dc:date>
    </item>
    <item>
      <title>Re: How to get catalog variable question and Selected value into email Notification (should support language)</title>
      <link>https://www.servicenow.com/community/service-management-forum/how-to-get-catalog-variable-question-and-selected-value-into/m-p/370539#M1852</link>
      <description>&lt;P&gt;Hey Sankeerth,&lt;/P&gt;&lt;BR /&gt;&lt;P&gt;&lt;/P&gt;&lt;BR /&gt;&lt;P&gt;Try to create a notification Script with the Below script and use the notification script in your email. Currently its working for all the Questions and values in the Request. &lt;/P&gt;&lt;BR /&gt;&lt;P&gt;&lt;/P&gt;&lt;BR /&gt;&lt;P&gt;(function runMailScript(current, template, email, email_action, event) {&lt;/P&gt;&lt;BR /&gt;&lt;P&gt;&lt;/P&gt;&lt;BR /&gt;&lt;P&gt;&lt;/P&gt;&lt;BR /&gt;&lt;P&gt; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; template.print("Summary of Catalog item:\n");&lt;/P&gt;&lt;BR /&gt;&lt;P&gt; &amp;nbsp; var scTask=new GlideRecord('sc_task');&lt;/P&gt;&lt;BR /&gt;&lt;P&gt;&lt;/P&gt;&lt;BR /&gt;&lt;P&gt; &amp;nbsp; scTask.addQuery("sys_id", current.sys_id);&lt;/P&gt;&lt;BR /&gt;&lt;P&gt; &amp;nbsp; scTask.query();&lt;/P&gt;&lt;BR /&gt;&lt;P&gt; &amp;nbsp; //gs.log(current.sys_id);&lt;/P&gt;&lt;BR /&gt;&lt;P&gt;&lt;/P&gt;&lt;BR /&gt;&lt;P&gt; &amp;nbsp; while(scTask.next())&lt;/P&gt;&lt;BR /&gt;&lt;P&gt; &amp;nbsp; {&lt;/P&gt;&lt;BR /&gt;&lt;P&gt;&lt;/P&gt;&lt;BR /&gt;&lt;P&gt; &amp;nbsp; var id = scTask.request_item;&lt;/P&gt;&lt;BR /&gt;&lt;P&gt; &amp;nbsp; //gs.log(id);&lt;/P&gt;&lt;BR /&gt;&lt;P&gt;&lt;/P&gt;&lt;BR /&gt;&lt;P&gt; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; var scReqItem = new GlideRecord("sc_req_item");&lt;/P&gt;&lt;BR /&gt;&lt;P&gt; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; scReqItem.addQuery("sys_id", id.toString());&lt;/P&gt;&lt;BR /&gt;&lt;P&gt; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; scReqItem.query();&lt;/P&gt;&lt;BR /&gt;&lt;P&gt;&lt;/P&gt;&lt;BR /&gt;&lt;P&gt; &amp;nbsp; //gs.log(id.toString());&lt;/P&gt;&lt;BR /&gt;&lt;P&gt;&lt;/P&gt;&lt;BR /&gt;&lt;P&gt;&lt;/P&gt;&lt;BR /&gt;&lt;P&gt;&lt;/P&gt;&lt;BR /&gt;&lt;P&gt;&lt;/P&gt;&lt;BR /&gt;&lt;P&gt;while (scReqItem.next())&lt;/P&gt;&lt;BR /&gt;&lt;P&gt;{&lt;/P&gt;&lt;BR /&gt;&lt;P&gt;&lt;/P&gt;&lt;BR /&gt;&lt;P&gt;gs.print(scReqItem.number + ": " + scReqItem.quantity + " X " + scReqItem.cat_item.getDisplayValue() + "\n");&lt;/P&gt;&lt;BR /&gt;&lt;P&gt;gs.print(" Options:\n");&lt;/P&gt;&lt;BR /&gt;&lt;P&gt;&lt;/P&gt;&lt;BR /&gt;&lt;P&gt;&lt;/P&gt;&lt;BR /&gt;&lt;P&gt;&lt;/P&gt;&lt;BR /&gt;&lt;P&gt;&lt;/P&gt;&lt;BR /&gt;&lt;P&gt;&lt;/P&gt;&lt;BR /&gt;&lt;P&gt;var varown = new GlideRecord('sc_item_option_mtom');&lt;/P&gt;&lt;BR /&gt;&lt;P&gt;varown.addQuery("request_item", current.request_item);&lt;/P&gt;&lt;BR /&gt;&lt;P&gt;varown.orderBy("sc_item_option.order");&lt;/P&gt;&lt;BR /&gt;&lt;P&gt;varown.query();&lt;/P&gt;&lt;BR /&gt;&lt;P&gt; &amp;nbsp; //gs.log(current.request_item);&lt;/P&gt;&lt;BR /&gt;&lt;P&gt;&lt;/P&gt;&lt;BR /&gt;&lt;P&gt;&lt;/P&gt;&lt;BR /&gt;&lt;P&gt;&lt;/P&gt;&lt;BR /&gt;&lt;P&gt;while (varown.next()) {&lt;/P&gt;&lt;BR /&gt;&lt;P&gt;&lt;/P&gt;&lt;BR /&gt;&lt;P&gt;var visible = varown.sc_item_option.item_option_new.visible_summary;&lt;/P&gt;&lt;BR /&gt;&lt;P&gt; &amp;nbsp; //gs.log(visible);&lt;/P&gt;&lt;BR /&gt;&lt;P&gt;&lt;/P&gt;&lt;BR /&gt;&lt;P&gt;//var question = Packages.com.glideapp.questionset.Question.getQuestion(varown.sc_item_option.item_option_new);//Packages call replaced with line below on CAlgary+&lt;/P&gt;&lt;BR /&gt;&lt;P&gt;&lt;/P&gt;&lt;BR /&gt;&lt;P&gt;var question = GlideappAbstractChoiceListQuestion.getQuestion(varown.sc_item_option.item_option_new);&lt;/P&gt;&lt;BR /&gt;&lt;P&gt;//gs.log(question);&lt;/P&gt;&lt;BR /&gt;&lt;P&gt;&lt;/P&gt;&lt;BR /&gt;&lt;P&gt;question.setValue(varown.sc_item_option.value);&lt;/P&gt;&lt;BR /&gt;&lt;P&gt;&lt;/P&gt;&lt;BR /&gt;&lt;P&gt;&lt;/P&gt;&lt;BR /&gt;&lt;P&gt;if (question.getLabel() != "" &amp;amp;&amp;amp; question.getDisplayValue() !="" &amp;amp;&amp;amp; question.getDisplayValue()!='false'&amp;amp;&amp;amp; visible == true)&lt;/P&gt;&lt;BR /&gt;&lt;P&gt; &amp;nbsp; {&lt;/P&gt;&lt;BR /&gt;&lt;P&gt;//template.space(4);&lt;/P&gt;&lt;BR /&gt;&lt;P&gt;template.print(' ' + question.getLabel() + " = " + question.getDisplayValue() + "&amp;lt;br/&amp;gt;");&lt;/P&gt;&lt;BR /&gt;&lt;P&gt;&lt;/P&gt;&lt;BR /&gt;&lt;P&gt;&lt;/P&gt;&lt;BR /&gt;&lt;P&gt;}&lt;/P&gt;&lt;BR /&gt;&lt;P&gt;&lt;/P&gt;&lt;BR /&gt;&lt;P&gt;&lt;/P&gt;&lt;BR /&gt;&lt;P&gt;}&lt;/P&gt;&lt;BR /&gt;&lt;P&gt;}&lt;/P&gt;&lt;BR /&gt;&lt;P&gt; &amp;nbsp; }&lt;/P&gt;&lt;BR /&gt;&lt;P&gt;&lt;/P&gt;&lt;BR /&gt;&lt;P&gt;&lt;/P&gt;&lt;BR /&gt;&lt;P&gt;})(current, template, email, email_action, event);&lt;/P&gt;&lt;BR /&gt;&lt;P&gt;&lt;/P&gt;&lt;BR /&gt;&lt;P&gt;Thanks &lt;/P&gt;&lt;BR /&gt;&lt;P&gt;Raghu&lt;/P&gt;&lt;BR /&gt;&lt;P&gt;&lt;SPAN style="font-family: arial, sans-serif;"&gt;---------------------------------------------------------------------------------------------------- &lt;/SPAN&gt;&lt;/P&gt;&lt;BR /&gt;&lt;P&gt;&lt;SPAN style="font-family: arial, sans-serif;"&gt;Please like or mark it helpful / correct based on the impact of this reply.&lt;/SPAN&gt;&lt;/P&gt;&lt;BR /&gt;</description>
      <pubDate>Sat, 24 Jun 2017 18:30:07 GMT</pubDate>
      <guid>https://www.servicenow.com/community/service-management-forum/how-to-get-catalog-variable-question-and-selected-value-into/m-p/370539#M1852</guid>
      <dc:creator>ragh</dc:creator>
      <dc:date>2017-06-24T18:30:07Z</dc:date>
    </item>
    <item>
      <title>Re: How to get catalog variable question and Selected value into email Notification (should support language)</title>
      <link>https://www.servicenow.com/community/service-management-forum/how-to-get-catalog-variable-question-and-selected-value-into/m-p/370540#M1853</link>
      <description>&lt;P&gt;I don't know if this would work, but if a variable's getLabel method retains language it might.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;(function runMailScript(current, template, email, email_action, event) {&lt;/P&gt;
&lt;P&gt;&amp;nbsp; var ritm = new GlideRecord('sc_req_item');&lt;BR /&gt; &lt;BR /&gt;&amp;nbsp; ritm.get(/* YOUR RITM SYS_ID HERE */);&lt;BR /&gt; &lt;BR /&gt;&amp;nbsp; var variable_names = Object.keys(ritm.variables); // Get all the keys in the RITM's variables object&lt;BR /&gt; &lt;BR /&gt;&amp;nbsp; var string = '';&lt;BR /&gt; &lt;BR /&gt;&amp;nbsp; for (var index = 0; index &amp;lt; variable_names.length - 1; ++ index) {&lt;BR /&gt; &lt;BR /&gt;&amp;nbsp; &amp;nbsp; var variable = ritm.variables[variable_names[index]];&lt;BR /&gt; &lt;BR /&gt;&amp;nbsp; &amp;nbsp; string += variable.getLabel() + " " + variable.getDisplayValue() + "&amp;lt;br&amp;gt;"; // Get the label and display value of each variable&lt;BR /&gt; &lt;BR /&gt;&amp;nbsp; }&lt;BR /&gt; &lt;BR /&gt;&amp;nbsp; template.print(string);&lt;/P&gt;
&lt;P&gt;})(current, template, email, email_action, event);&lt;/P&gt;</description>
      <pubDate>Mon, 09 Mar 2020 17:46:46 GMT</pubDate>
      <guid>https://www.servicenow.com/community/service-management-forum/how-to-get-catalog-variable-question-and-selected-value-into/m-p/370540#M1853</guid>
      <dc:creator>userpoth1</dc:creator>
      <dc:date>2020-03-09T17:46:46Z</dc:date>
    </item>
  </channel>
</rss>

