<?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 Get fields and their values from another table in SP widget? in Developer forum</title>
    <link>https://www.servicenow.com/community/developer-forum/get-fields-and-their-values-from-another-table-in-sp-widget/m-p/2179747#M836673</link>
    <description>&lt;P&gt;I am working with the Ticket Fields widget in Service Portal. When I look at the code, I see &lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;var fields = $sp.getFields(gr, 'fieldnameshere');&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;From what I can tell, this is simply getting specified field names from the current record. Then in the html body, we run a ng-repeat="field in data.fields" &amp;nbsp; and print the label and value of each field. I like the layout of this widget and have cloned it. However, I have the current table set to the sysapproval_approver table. I would like the fields to be selected from the corresponding task that needs approval. &lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;So basically, the server script sets gr to the current record. I set inc to the sysapproval record. From this point, I want to say fields = specific fields from the incident table, not the sysapproval table.&lt;/P&gt;&lt;P&gt;var gr = $sp.getRecord();&lt;/P&gt;&lt;P&gt;var inc= gr.sysapproval;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;All help is much appreciated.&lt;/P&gt;</description>
    <pubDate>Tue, 11 Apr 2017 16:16:55 GMT</pubDate>
    <dc:creator>robhaas</dc:creator>
    <dc:date>2017-04-11T16:16:55Z</dc:date>
    <item>
      <title>Get fields and their values from another table in SP widget?</title>
      <link>https://www.servicenow.com/community/developer-forum/get-fields-and-their-values-from-another-table-in-sp-widget/m-p/2179747#M836673</link>
      <description>&lt;P&gt;I am working with the Ticket Fields widget in Service Portal. When I look at the code, I see &lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;var fields = $sp.getFields(gr, 'fieldnameshere');&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;From what I can tell, this is simply getting specified field names from the current record. Then in the html body, we run a ng-repeat="field in data.fields" &amp;nbsp; and print the label and value of each field. I like the layout of this widget and have cloned it. However, I have the current table set to the sysapproval_approver table. I would like the fields to be selected from the corresponding task that needs approval. &lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;So basically, the server script sets gr to the current record. I set inc to the sysapproval record. From this point, I want to say fields = specific fields from the incident table, not the sysapproval table.&lt;/P&gt;&lt;P&gt;var gr = $sp.getRecord();&lt;/P&gt;&lt;P&gt;var inc= gr.sysapproval;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;All help is much appreciated.&lt;/P&gt;</description>
      <pubDate>Tue, 11 Apr 2017 16:16:55 GMT</pubDate>
      <guid>https://www.servicenow.com/community/developer-forum/get-fields-and-their-values-from-another-table-in-sp-widget/m-p/2179747#M836673</guid>
      <dc:creator>robhaas</dc:creator>
      <dc:date>2017-04-11T16:16:55Z</dc:date>
    </item>
    <item>
      <title>Re: Get fields and their values from another table in SP widget?</title>
      <link>https://www.servicenow.com/community/developer-forum/get-fields-and-their-values-from-another-table-in-sp-widget/m-p/2179748#M836674</link>
      <description>&lt;P&gt;When using $sp.getRecord() with no parameters given the method will return the GlideRecord of the current "widget instance". To get a GlideRecord of a specific table then you must pass the parameters (table, sys_id) or (table, GlideElement).&lt;/P&gt;&lt;BR /&gt;&lt;P&gt;So something like so should work:&lt;/P&gt;&lt;BR /&gt;&lt;P&gt; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; var gr = $sp.getRecord('incident', '9c573169c611228700193229fff72400') // substitute table and sys_id with desired data&lt;/P&gt;&lt;BR /&gt;&lt;P&gt; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; var inc_short_desc = gr.short_description; // substitute with the desired fields&lt;/P&gt;&lt;BR /&gt;</description>
      <pubDate>Wed, 12 Apr 2017 01:12:34 GMT</pubDate>
      <guid>https://www.servicenow.com/community/developer-forum/get-fields-and-their-values-from-another-table-in-sp-widget/m-p/2179748#M836674</guid>
      <dc:creator>ChrisBurks</dc:creator>
      <dc:date>2017-04-12T01:12:34Z</dc:date>
    </item>
    <item>
      <title>Re: Get fields and their values from another table in SP widget?</title>
      <link>https://www.servicenow.com/community/developer-forum/get-fields-and-their-values-from-another-table-in-sp-widget/m-p/2179749#M836675</link>
      <description>&lt;P&gt;For some reason this didn't post as a question. However, I marked your response as helpful and liked it as it was exactly what I needed. Appreciate it!&lt;/P&gt;&lt;BR /&gt;</description>
      <pubDate>Wed, 12 Apr 2017 10:37:53 GMT</pubDate>
      <guid>https://www.servicenow.com/community/developer-forum/get-fields-and-their-values-from-another-table-in-sp-widget/m-p/2179749#M836675</guid>
      <dc:creator>robhaas</dc:creator>
      <dc:date>2017-04-12T10:37:53Z</dc:date>
    </item>
    <item>
      <title>Re: Get fields and their values from another table in SP widget?</title>
      <link>https://www.servicenow.com/community/developer-forum/get-fields-and-their-values-from-another-table-in-sp-widget/m-p/2179750#M836676</link>
      <description>&lt;P&gt;Thought this might be helpful&lt;/P&gt;&lt;BR /&gt;&lt;P&gt;&lt;A title="Portal diaries: Service Portal — Approval Summarizer in Portal" __default_attr="6416" __jive_macro_name="blogpost" class="jive_macro jive_macro_blogpost" data-orig-content="Portal diaries: Service Portal — Approval Summarizer in Portal" data-renderedposition="52_8_407_16" href="https://www.servicenow.com/community?id=community_blog&amp;amp;sys_id=ac4daee5dbd0dbc01dcaf3231f96193b"&gt;Portal diaries: Service Portal — Approval Summarizer in Portal&lt;/A&gt; &lt;/P&gt;&lt;BR /&gt;</description>
      <pubDate>Wed, 12 Apr 2017 12:36:50 GMT</pubDate>
      <guid>https://www.servicenow.com/community/developer-forum/get-fields-and-their-values-from-another-table-in-sp-widget/m-p/2179750#M836676</guid>
      <dc:creator>dvp</dc:creator>
      <dc:date>2017-04-12T12:36:50Z</dc:date>
    </item>
    <item>
      <title>Re: Get fields and their values from another table in SP widget?</title>
      <link>https://www.servicenow.com/community/developer-forum/get-fields-and-their-values-from-another-table-in-sp-widget/m-p/2179751#M836677</link>
      <description>&lt;P&gt;No worries. Glad I could help.&lt;/P&gt;&lt;BR /&gt;</description>
      <pubDate>Thu, 13 Apr 2017 02:41:16 GMT</pubDate>
      <guid>https://www.servicenow.com/community/developer-forum/get-fields-and-their-values-from-another-table-in-sp-widget/m-p/2179751#M836677</guid>
      <dc:creator>ChrisBurks</dc:creator>
      <dc:date>2017-04-13T02:41:16Z</dc:date>
    </item>
  </channel>
</rss>

