<?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: Service Portal Widget: how to get sys_id ? in Developer forum</title>
    <link>https://www.servicenow.com/community/developer-forum/service-portal-widget-how-to-get-sys-id/m-p/2132086#M789012</link>
    <description>&lt;P&gt;No on service portal &lt;SPAN style="color: #666666; font-family: arial, sans-serif; background-color: #edf8ca;"&gt;gr.getDisplayValue("sys_id"), it only works.&lt;/SPAN&gt;&lt;/P&gt;&lt;BR /&gt;&lt;P&gt;&lt;SPAN style="background-color: #edf8ca; color: #666666; font-family: arial, sans-serif;"&gt;customer.id = gr.sys_id+'' and &lt;SPAN style="color: #666666; font-family: arial, sans-serif;"&gt;customer.id = gr.getValue('sys_id') all are not working.&lt;/SPAN&gt;&lt;/SPAN&gt;&lt;/P&gt;&lt;BR /&gt;</description>
    <pubDate>Wed, 26 Apr 2017 18:34:58 GMT</pubDate>
    <dc:creator>BALAJI40</dc:creator>
    <dc:date>2017-04-26T18:34:58Z</dc:date>
    <item>
      <title>Service Portal Widget: how to get sys_id ?</title>
      <link>https://www.servicenow.com/community/developer-forum/service-portal-widget-how-to-get-sys-id/m-p/2132078#M789004</link>
      <description>&lt;P&gt;Hi guys,&lt;/P&gt;&lt;P&gt;In my custom Customer table how can I get sys_id for each record?&lt;/P&gt;&lt;PRE __default_attr="javascript" __jive_macro_name="code" class="jive_macro_code _jivemacro_uid_14932247515197335 jive_text_macro" data-renderedposition="50_8_1192_208" jivemacro_uid="_14932247515197335" modifiedtitle="true"&gt;&lt;P&gt;var gr = new GlideRecord("x_11111_notes_customers");&lt;/P&gt;&lt;P&gt;gr.addActiveQuery();&lt;/P&gt;&lt;P&gt;gr.orderByDesc('sys_updated_on');&lt;/P&gt;&lt;P&gt;gr.query();&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;data.customers = [];&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;while(gr.next()){&lt;/P&gt;&lt;P&gt; &amp;nbsp; &amp;nbsp; &amp;nbsp; var customer = {};&lt;/P&gt;&lt;P&gt; &amp;nbsp; &amp;nbsp; &amp;nbsp; customer.id = gr.sys_id;&lt;/P&gt;&lt;P&gt; &amp;nbsp; &amp;nbsp; &amp;nbsp; customer.name = gr.getDisplayValue('name');&lt;/P&gt;&lt;P&gt; &amp;nbsp; &amp;nbsp; &amp;nbsp; data.customers.push(customer);&lt;/P&gt;&lt;P&gt;}&lt;/P&gt;&lt;/PRE&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;This code in line #10 returns nothing.&lt;/P&gt;&lt;P&gt;Where I am wrong?&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Thanks&lt;/P&gt;</description>
      <pubDate>Wed, 26 Apr 2017 16:40:08 GMT</pubDate>
      <guid>https://www.servicenow.com/community/developer-forum/service-portal-widget-how-to-get-sys-id/m-p/2132078#M789004</guid>
      <dc:creator>stryker129</dc:creator>
      <dc:date>2017-04-26T16:40:08Z</dc:date>
    </item>
    <item>
      <title>Re: Service Portal Widget: how to get sys_id ?</title>
      <link>https://www.servicenow.com/community/developer-forum/service-portal-widget-how-to-get-sys-id/m-p/2132079#M789005</link>
      <description>&lt;P&gt;Use this one, $sp.getParameter("sys_id")&lt;/P&gt;&lt;BR /&gt;&lt;P&gt;Can i know what you are doing above I did not understand.&lt;/P&gt;&lt;BR /&gt;</description>
      <pubDate>Wed, 26 Apr 2017 16:45:23 GMT</pubDate>
      <guid>https://www.servicenow.com/community/developer-forum/service-portal-widget-how-to-get-sys-id/m-p/2132079#M789005</guid>
      <dc:creator>BALAJI40</dc:creator>
      <dc:date>2017-04-26T16:45:23Z</dc:date>
    </item>
    <item>
      <title>Re: Service Portal Widget: how to get sys_id ?</title>
      <link>https://www.servicenow.com/community/developer-forum/service-portal-widget-how-to-get-sys-id/m-p/2132080#M789006</link>
      <description>&lt;P&gt;There is no code above. This is the full Server Script in my widget. The requirement is to get all records with sys_id and name from Customers table and pass the data to Client. &lt;/P&gt;&lt;BR /&gt;</description>
      <pubDate>Wed, 26 Apr 2017 16:53:37 GMT</pubDate>
      <guid>https://www.servicenow.com/community/developer-forum/service-portal-widget-how-to-get-sys-id/m-p/2132080#M789006</guid>
      <dc:creator>stryker129</dc:creator>
      <dc:date>2017-04-26T16:53:37Z</dc:date>
    </item>
    <item>
      <title>Re: Service Portal Widget: how to get sys_id ?</title>
      <link>https://www.servicenow.com/community/developer-forum/service-portal-widget-how-to-get-sys-id/m-p/2132081#M789007</link>
      <description>&lt;P&gt;Hi Ivan,&lt;/P&gt;&lt;BR /&gt;&lt;P&gt;&lt;/P&gt;&lt;BR /&gt;&lt;P&gt;Replace customer.id = gr.sys_id; with customer.id = gr.getValue('sys_id') or customer.id = gr.sys_id+'';&lt;/P&gt;&lt;BR /&gt;&lt;P&gt;&lt;/P&gt;&lt;BR /&gt;&lt;P&gt;Hope this helps.&lt;/P&gt;&lt;BR /&gt;&lt;P&gt;&lt;/P&gt;&lt;BR /&gt;&lt;P&gt;Regards,&lt;/P&gt;&lt;BR /&gt;&lt;P&gt;Ujjawal&lt;/P&gt;&lt;BR /&gt;&lt;P&gt;&lt;/P&gt;&lt;BR /&gt;&lt;P&gt;&lt;/P&gt;&lt;BR /&gt;</description>
      <pubDate>Wed, 26 Apr 2017 17:08:44 GMT</pubDate>
      <guid>https://www.servicenow.com/community/developer-forum/service-portal-widget-how-to-get-sys-id/m-p/2132081#M789007</guid>
      <dc:creator>Ujjawal Vishnoi</dc:creator>
      <dc:date>2017-04-26T17:08:44Z</dc:date>
    </item>
    <item>
      <title>Re: Service Portal Widget: how to get sys_id ?</title>
      <link>https://www.servicenow.com/community/developer-forum/service-portal-widget-how-to-get-sys-id/m-p/2132082#M789008</link>
      <description>&lt;P&gt;Ivan,&lt;/P&gt;&lt;BR /&gt;&lt;P&gt;When I have encountered this issue in the past what you need to do is either convert the sys_id to a string gr.sys_id.toString() or get the display value gr.getDisplayValue("sys_id") of the sys_id. I am not really sure why you need to do it this way but this is how I was able to resolve it when I ran into it,&lt;/P&gt;&lt;BR /&gt;&lt;P&gt;&lt;/P&gt;&lt;BR /&gt;&lt;P&gt;Code Example:&lt;/P&gt;&lt;BR /&gt;&lt;P&gt;&lt;/P&gt;&lt;BR /&gt;&lt;P&gt;data.customers = [];&lt;/P&gt;&lt;BR /&gt;&lt;P&gt;var gr = new GlideRecord("x_11111_notes_customer");&lt;/P&gt;&lt;BR /&gt;&lt;P&gt;gr.addActiveQuery(); gr.orderByDesc("sys_updated_on");&lt;/P&gt;&lt;BR /&gt;&lt;P&gt;gr.query();&lt;/P&gt;&lt;BR /&gt;&lt;P&gt;while(gr.next()){ &amp;nbsp; &amp;nbsp; &amp;nbsp; &lt;/P&gt;&lt;BR /&gt;&lt;P&gt; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; customer = {}; &amp;nbsp; &amp;nbsp; &amp;nbsp; &lt;/P&gt;&lt;BR /&gt;&lt;P&gt; &amp;nbsp; &amp;nbsp; &amp;nbsp; customer.id = gr.getDisplayValue("sys_id"); &amp;nbsp; &amp;nbsp; &amp;nbsp; &lt;/P&gt;&lt;BR /&gt;&lt;P&gt; &amp;nbsp; &amp;nbsp; &amp;nbsp; customer.name = gr.getDisplayValue("name"); &amp;nbsp; &amp;nbsp; &amp;nbsp; &lt;/P&gt;&lt;BR /&gt;&lt;P&gt; &amp;nbsp; &amp;nbsp; &amp;nbsp; data.customers.push(customer);&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;Hope this helps..&lt;/P&gt;&lt;BR /&gt;&lt;P&gt;&lt;/P&gt;&lt;BR /&gt;&lt;P&gt;Freddie&lt;/P&gt;&lt;BR /&gt;</description>
      <pubDate>Wed, 26 Apr 2017 18:18:53 GMT</pubDate>
      <guid>https://www.servicenow.com/community/developer-forum/service-portal-widget-how-to-get-sys-id/m-p/2132082#M789008</guid>
      <dc:creator>Freddie Pokrzy1</dc:creator>
      <dc:date>2017-04-26T18:18:53Z</dc:date>
    </item>
    <item>
      <title>Re: Service Portal Widget: how to get sys_id ?</title>
      <link>https://www.servicenow.com/community/developer-forum/service-portal-widget-how-to-get-sys-id/m-p/2132083#M789009</link>
      <description>&lt;P&gt;I need it for editing specific customer in custom Service Portal page form. &lt;/P&gt;&lt;BR /&gt;</description>
      <pubDate>Wed, 26 Apr 2017 18:24:55 GMT</pubDate>
      <guid>https://www.servicenow.com/community/developer-forum/service-portal-widget-how-to-get-sys-id/m-p/2132083#M789009</guid>
      <dc:creator>stryker129</dc:creator>
      <dc:date>2017-04-26T18:24:55Z</dc:date>
    </item>
    <item>
      <title>Re: Service Portal Widget: how to get sys_id ?</title>
      <link>https://www.servicenow.com/community/developer-forum/service-portal-widget-how-to-get-sys-id/m-p/2132084#M789010</link>
      <description>&lt;P&gt;Hi Ivan,&lt;/P&gt;&lt;BR /&gt;&lt;P&gt;&lt;/P&gt;&lt;BR /&gt;&lt;P&gt;Have you tried to replace customer.id = gr.sys_id; with customer.id = gr.sys_id+'';&lt;/P&gt;&lt;BR /&gt;&lt;P&gt;&lt;/P&gt;&lt;BR /&gt;&lt;P&gt;As per my understanding this should also work.&lt;/P&gt;&lt;BR /&gt;&lt;P&gt;&lt;/P&gt;&lt;BR /&gt;&lt;P&gt;Regards&lt;/P&gt;&lt;BR /&gt;&lt;P&gt;Ujjawal&lt;/P&gt;&lt;BR /&gt;</description>
      <pubDate>Wed, 26 Apr 2017 18:30:15 GMT</pubDate>
      <guid>https://www.servicenow.com/community/developer-forum/service-portal-widget-how-to-get-sys-id/m-p/2132084#M789010</guid>
      <dc:creator>Ujjawal Vishnoi</dc:creator>
      <dc:date>2017-04-26T18:30:15Z</dc:date>
    </item>
    <item>
      <title>Re: Service Portal Widget: how to get sys_id ?</title>
      <link>https://www.servicenow.com/community/developer-forum/service-portal-widget-how-to-get-sys-id/m-p/2132085#M789011</link>
      <description>&lt;P&gt;Not yet. Will try tomorrow. sys_id +'' - LOL &lt;SPAN __jive_emoticon_name="happy" __jive_macro_name="emoticon" class="jive_emote jive_macro" data-renderedposition="29_35.703125_16_16" src="https://www.servicenow.com/8.0.4.21bdc7e/images/emoticons/happy.png"&gt;&lt;/SPAN&gt; is it a bug in SN?&lt;/P&gt;&lt;BR /&gt;</description>
      <pubDate>Wed, 26 Apr 2017 18:34:28 GMT</pubDate>
      <guid>https://www.servicenow.com/community/developer-forum/service-portal-widget-how-to-get-sys-id/m-p/2132085#M789011</guid>
      <dc:creator>stryker129</dc:creator>
      <dc:date>2017-04-26T18:34:28Z</dc:date>
    </item>
    <item>
      <title>Re: Service Portal Widget: how to get sys_id ?</title>
      <link>https://www.servicenow.com/community/developer-forum/service-portal-widget-how-to-get-sys-id/m-p/2132086#M789012</link>
      <description>&lt;P&gt;No on service portal &lt;SPAN style="color: #666666; font-family: arial, sans-serif; background-color: #edf8ca;"&gt;gr.getDisplayValue("sys_id"), it only works.&lt;/SPAN&gt;&lt;/P&gt;&lt;BR /&gt;&lt;P&gt;&lt;SPAN style="background-color: #edf8ca; color: #666666; font-family: arial, sans-serif;"&gt;customer.id = gr.sys_id+'' and &lt;SPAN style="color: #666666; font-family: arial, sans-serif;"&gt;customer.id = gr.getValue('sys_id') all are not working.&lt;/SPAN&gt;&lt;/SPAN&gt;&lt;/P&gt;&lt;BR /&gt;</description>
      <pubDate>Wed, 26 Apr 2017 18:34:58 GMT</pubDate>
      <guid>https://www.servicenow.com/community/developer-forum/service-portal-widget-how-to-get-sys-id/m-p/2132086#M789012</guid>
      <dc:creator>BALAJI40</dc:creator>
      <dc:date>2017-04-26T18:34:58Z</dc:date>
    </item>
    <item>
      <title>Re: Service Portal Widget: how to get sys_id ?</title>
      <link>https://www.servicenow.com/community/developer-forum/service-portal-widget-how-to-get-sys-id/m-p/2132087#M789013</link>
      <description>&lt;P&gt;It is same as toString().&lt;/P&gt;&lt;BR /&gt;&lt;P&gt;&lt;/P&gt;&lt;BR /&gt;&lt;P&gt;In your previous scenario when you were using &lt;SPAN style="color: #666666; font-family: arial, sans-serif;"&gt;customer.id = gr.sys_id then in this case you were actually assigning an object to customer.id. However you were expecting the value of sys_id. That was the issue.&lt;/SPAN&gt;&lt;/P&gt;&lt;BR /&gt;&lt;P&gt;&lt;/P&gt;&lt;BR /&gt;&lt;P&gt;&lt;SPAN style="color: #666666; font-family: arial, sans-serif;"&gt;Hope this helps.&lt;/SPAN&gt;&lt;/P&gt;&lt;BR /&gt;&lt;P&gt;&lt;/P&gt;&lt;BR /&gt;&lt;P&gt;&lt;SPAN style="color: #666666; font-family: arial, sans-serif;"&gt;Regards&lt;/SPAN&gt;&lt;/P&gt;&lt;BR /&gt;&lt;P&gt;&lt;SPAN style="color: #666666; font-family: arial, sans-serif;"&gt;Ujjawal&lt;/SPAN&gt;&lt;/P&gt;&lt;BR /&gt;</description>
      <pubDate>Wed, 26 Apr 2017 18:38:17 GMT</pubDate>
      <guid>https://www.servicenow.com/community/developer-forum/service-portal-widget-how-to-get-sys-id/m-p/2132087#M789013</guid>
      <dc:creator>Ujjawal Vishnoi</dc:creator>
      <dc:date>2017-04-26T18:38:17Z</dc:date>
    </item>
    <item>
      <title>Re: Service Portal Widget: how to get sys_id ?</title>
      <link>https://www.servicenow.com/community/developer-forum/service-portal-widget-how-to-get-sys-id/m-p/2132088#M789014</link>
      <description>&lt;P&gt;Thanks. It works.&lt;/P&gt;&lt;BR /&gt;</description>
      <pubDate>Thu, 27 Apr 2017 12:25:45 GMT</pubDate>
      <guid>https://www.servicenow.com/community/developer-forum/service-portal-widget-how-to-get-sys-id/m-p/2132088#M789014</guid>
      <dc:creator>stryker129</dc:creator>
      <dc:date>2017-04-27T12:25:45Z</dc:date>
    </item>
  </channel>
</rss>

