<?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: Reference field shows value as 'undefined' in Developer forum</title>
    <link>https://www.servicenow.com/community/developer-forum/reference-field-shows-value-as-undefined/m-p/1492182#M149108</link>
    <description>&lt;P&gt;It worked, thanks a lot!&lt;/P&gt;&lt;BR /&gt;&lt;P&gt;&lt;/P&gt;&lt;BR /&gt;&lt;P&gt;Would it be too much if I asked you to explain me why?&lt;/P&gt;&lt;BR /&gt;&lt;P&gt;&lt;/P&gt;&lt;BR /&gt;&lt;P&gt;What's the difference between assigning directly with only current and using current.getValue('x');&lt;/P&gt;&lt;BR /&gt;</description>
    <pubDate>Thu, 21 Dec 2017 01:47:14 GMT</pubDate>
    <dc:creator>AnotherNOWDev</dc:creator>
    <dc:date>2017-12-21T01:47:14Z</dc:date>
    <item>
      <title>Reference field shows value as 'undefined'</title>
      <link>https://www.servicenow.com/community/developer-forum/reference-field-shows-value-as-undefined/m-p/1492180#M149106</link>
      <description>&lt;P&gt;Hello,&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;I'm currently working on a &lt;STRONG&gt;'after- insert'&lt;/STRONG&gt; Business Rule that initializes a new record using current values, but some are sending an 'undefined' value even though they are full.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;All values being managed are from reference fields&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;For example we have this two fields in the current form.&lt;/P&gt;&lt;P&gt;- Area Desarrollo (u_area_desarrollo)&lt;/P&gt;&lt;P&gt;- Clasificación del Proyecto (&lt;SPAN style="color: #343d47; font-family: SourceSansPro, 'Helvetica Neue', Arial; font-size: 13px;"&gt;u_clasificacion_del_proyecto)&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;IMG class="jive-image" src="https://i.imgur.com/1VYODnl.png?1" /&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Now.. after they insert that record the business rule triggers and this is the code&lt;/P&gt;&lt;PRE __default_attr="javascript" __jive_macro_name="code" class="_jivemacro_uid_15138184986262466 jive_macro_code jive_text_macro" data-renderedposition="606_8_1192_96" jivemacro_uid="_15138184986262466"&gt;&lt;P&gt;// This is the part of the code where the mistake appears&lt;/P&gt;&lt;P&gt;var gr = new GlideRecord('pm_project');&lt;/P&gt;&lt;P&gt;gr.initialize();&lt;/P&gt;&lt;P&gt;gr.u_area_desarrollo = current.u_area_desarrollo;&lt;/P&gt;&lt;P&gt;gr.&lt;SPAN style="color: #343d47; font-family: SourceSansPro, 'Helvetica Neue', Arial; font-size: 13px;"&gt;u_clasificacion_del_proyecto = current.&lt;SPAN style="color: #343d47; font-family: SourceSansPro, 'Helvetica Neue', Arial; font-size: 13px;"&gt;u_clasificacion_del_proyecto;&lt;/SPAN&gt;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="color: #343d47; font-size: 13px; font-family: SourceSansPro, 'Helvetica Neue', Arial;"&gt;gr.insert();&lt;/SPAN&gt;&lt;/P&gt;&lt;/PRE&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="color: #343d47; font-size: 13px; font-family: SourceSansPro, 'Helvetica Neue', Arial;"&gt;After the Business Rule runs, this is how the new record's form shows. You can see that 'Clasificación del Proyecto' got filled, while 'Area Desarrollo' stayed empty.&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="color: #343d47; font-size: 13px; font-family: SourceSansPro, 'Helvetica Neue', Arial;"&gt;&lt;IMG class="jive-image" src="https://i.imgur.com/GG0wux9.png?1" /&gt;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="color: #343d47; font-family: SourceSansPro, 'Helvetica Neue', Arial; font-size: 13px;"&gt;When I displayed the values in a string, 'Clasificación del Proyecto' brings the sys_id of the reference (as planned) and 'Area Desarrollo' displays a value of 'undefined'. Why is this happening? Any ideas?&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="color: #343d47; font-family: SourceSansPro, 'Helvetica Neue', Arial; font-size: 13px;"&gt;If you need any more information please let me know&lt;/SPAN&gt;&lt;/P&gt;</description>
      <pubDate>Thu, 21 Dec 2017 01:23:32 GMT</pubDate>
      <guid>https://www.servicenow.com/community/developer-forum/reference-field-shows-value-as-undefined/m-p/1492180#M149106</guid>
      <dc:creator>AnotherNOWDev</dc:creator>
      <dc:date>2017-12-21T01:23:32Z</dc:date>
    </item>
    <item>
      <title>Re: Reference field shows value as 'undefined'</title>
      <link>https://www.servicenow.com/community/developer-forum/reference-field-shows-value-as-undefined/m-p/1492181#M149107</link>
      <description>&lt;P&gt;Hello Andres,&lt;/P&gt;&lt;BR /&gt;&lt;P&gt;&lt;/P&gt;&lt;BR /&gt;&lt;P&gt;Can you replace current.u_area_desarrollo; with current.getValue('u_area_desarrollo'); and check once. Also is there any reference qualifier on the target reference field?&lt;/P&gt;&lt;BR /&gt;</description>
      <pubDate>Thu, 21 Dec 2017 01:36:36 GMT</pubDate>
      <guid>https://www.servicenow.com/community/developer-forum/reference-field-shows-value-as-undefined/m-p/1492181#M149107</guid>
      <dc:creator>Pradeep Sharma</dc:creator>
      <dc:date>2017-12-21T01:36:36Z</dc:date>
    </item>
    <item>
      <title>Re: Reference field shows value as 'undefined'</title>
      <link>https://www.servicenow.com/community/developer-forum/reference-field-shows-value-as-undefined/m-p/1492182#M149108</link>
      <description>&lt;P&gt;It worked, thanks a lot!&lt;/P&gt;&lt;BR /&gt;&lt;P&gt;&lt;/P&gt;&lt;BR /&gt;&lt;P&gt;Would it be too much if I asked you to explain me why?&lt;/P&gt;&lt;BR /&gt;&lt;P&gt;&lt;/P&gt;&lt;BR /&gt;&lt;P&gt;What's the difference between assigning directly with only current and using current.getValue('x');&lt;/P&gt;&lt;BR /&gt;</description>
      <pubDate>Thu, 21 Dec 2017 01:47:14 GMT</pubDate>
      <guid>https://www.servicenow.com/community/developer-forum/reference-field-shows-value-as-undefined/m-p/1492182#M149108</guid>
      <dc:creator>AnotherNOWDev</dc:creator>
      <dc:date>2017-12-21T01:47:14Z</dc:date>
    </item>
    <item>
      <title>Re: Reference field shows value as 'undefined'</title>
      <link>https://www.servicenow.com/community/developer-forum/reference-field-shows-value-as-undefined/m-p/1492183#M149109</link>
      <description>&lt;P&gt;Thanks for the update Andres. Output will be object if we fetch the value directly and it will be string if we use current.getValue('fieldname');&lt;/P&gt;&lt;BR /&gt;&lt;P&gt;&lt;/P&gt;&lt;BR /&gt;&lt;P&gt;I hope this answers your question.&lt;/P&gt;&lt;BR /&gt;&lt;P&gt;&lt;/P&gt;&lt;BR /&gt;&lt;P&gt;&lt;A href="https://docs.servicenow.com/bundle/jakarta-application-development/page/app-store/dev_portal/API_reference/glideRecordScoped/concept/c_GlideRecordScopedAPI.html" title="https://docs.servicenow.com/bundle/jakarta-application-development/page/app-store/dev_portal/API_reference/glideRecordScoped/concept/c_GlideRecordScopedAPI.html"&gt; &lt;/A&gt;&lt;/P&gt;&lt;BR /&gt;</description>
      <pubDate>Thu, 21 Dec 2017 02:04:43 GMT</pubDate>
      <guid>https://www.servicenow.com/community/developer-forum/reference-field-shows-value-as-undefined/m-p/1492183#M149109</guid>
      <dc:creator>Pradeep Sharma</dc:creator>
      <dc:date>2017-12-21T02:04:43Z</dc:date>
    </item>
  </channel>
</rss>

