<?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 Getting Values from Multi Row Variable Set Record Producer in Developer forum</title>
    <link>https://www.servicenow.com/community/developer-forum/getting-values-from-multi-row-variable-set-record-producer/m-p/1405772#M62698</link>
    <description>&lt;P&gt;I am having trouble inserting data into my related list from a MRVS for my record producer. Any suggestions on what I am doing wrong?&lt;/P&gt;
&lt;P&gt;MRVS name = 'other contacts';&lt;/P&gt;
&lt;P&gt;variable name = 'name';&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;var contactArr = producer.other_contacts;&lt;BR /&gt;var contactCnt = producer.other_contacts.getRowCount();&lt;/P&gt;
&lt;P&gt;if (contactCnt &amp;gt; 0) {&lt;BR /&gt;&amp;nbsp; &amp;nbsp; for (i = 0; 1 &amp;lt; contactCnt; i++) {&lt;BR /&gt;&amp;nbsp; &amp;nbsp; var gr = new('related_record');&lt;BR /&gt;&amp;nbsp; &amp;nbsp; gr.initialize();&lt;BR /&gt;&amp;nbsp; &amp;nbsp;gr.setValue('name',contactArr[i].name);&lt;BR /&gt;&amp;nbsp; &amp;nbsp;database.insert();&lt;BR /&gt;&amp;nbsp;}&lt;BR /&gt;}&lt;/P&gt;
&lt;P&gt;I am getting the correct row count I just cannot get the data from the array;&lt;/P&gt;</description>
    <pubDate>Sun, 17 May 2020 04:54:22 GMT</pubDate>
    <dc:creator>gregrice</dc:creator>
    <dc:date>2020-05-17T04:54:22Z</dc:date>
    <item>
      <title>Getting Values from Multi Row Variable Set Record Producer</title>
      <link>https://www.servicenow.com/community/developer-forum/getting-values-from-multi-row-variable-set-record-producer/m-p/1405772#M62698</link>
      <description>&lt;P&gt;I am having trouble inserting data into my related list from a MRVS for my record producer. Any suggestions on what I am doing wrong?&lt;/P&gt;
&lt;P&gt;MRVS name = 'other contacts';&lt;/P&gt;
&lt;P&gt;variable name = 'name';&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;var contactArr = producer.other_contacts;&lt;BR /&gt;var contactCnt = producer.other_contacts.getRowCount();&lt;/P&gt;
&lt;P&gt;if (contactCnt &amp;gt; 0) {&lt;BR /&gt;&amp;nbsp; &amp;nbsp; for (i = 0; 1 &amp;lt; contactCnt; i++) {&lt;BR /&gt;&amp;nbsp; &amp;nbsp; var gr = new('related_record');&lt;BR /&gt;&amp;nbsp; &amp;nbsp; gr.initialize();&lt;BR /&gt;&amp;nbsp; &amp;nbsp;gr.setValue('name',contactArr[i].name);&lt;BR /&gt;&amp;nbsp; &amp;nbsp;database.insert();&lt;BR /&gt;&amp;nbsp;}&lt;BR /&gt;}&lt;/P&gt;
&lt;P&gt;I am getting the correct row count I just cannot get the data from the array;&lt;/P&gt;</description>
      <pubDate>Sun, 17 May 2020 04:54:22 GMT</pubDate>
      <guid>https://www.servicenow.com/community/developer-forum/getting-values-from-multi-row-variable-set-record-producer/m-p/1405772#M62698</guid>
      <dc:creator>gregrice</dc:creator>
      <dc:date>2020-05-17T04:54:22Z</dc:date>
    </item>
    <item>
      <title>Re: Getting Values from Multi Row Variable Set Record Producer</title>
      <link>https://www.servicenow.com/community/developer-forum/getting-values-from-multi-row-variable-set-record-producer/m-p/1405773#M62699</link>
      <description>&lt;P&gt;Hi,&lt;/P&gt;
&lt;P&gt;the value you get from MRVS is json; you need to parse that&lt;/P&gt;
&lt;P&gt;also print if you are getting proper json&lt;/P&gt;
&lt;P&gt;&lt;SPAN class="ng-scope"&gt;correct this mistake/error; i &amp;lt; contactCnt&lt;/SPAN&gt;&lt;/P&gt;
&lt;P&gt;&lt;SPAN class="ng-scope"&gt;for (i = 0; &lt;STRONG&gt;i&lt;/STRONG&gt; &amp;lt; contactCnt; i++) {&lt;/SPAN&gt;&lt;/P&gt;
&lt;P&gt;Mark &lt;span class="lia-unicode-emoji" title=":white_heavy_check_mark:"&gt;✅&lt;/span&gt; Correct if this solves your issue and also mark &lt;span class="lia-unicode-emoji" title=":thumbs_up:"&gt;👍&lt;/span&gt; Helpful if you find my response worthy based on the impact.&lt;BR /&gt;Thanks&lt;BR /&gt;Ankur&lt;/P&gt;</description>
      <pubDate>Sun, 17 May 2020 05:21:13 GMT</pubDate>
      <guid>https://www.servicenow.com/community/developer-forum/getting-values-from-multi-row-variable-set-record-producer/m-p/1405773#M62699</guid>
      <dc:creator>Ankur Bawiskar</dc:creator>
      <dc:date>2020-05-17T05:21:13Z</dc:date>
    </item>
    <item>
      <title>Re: Getting Values from Multi Row Variable Set Record Producer</title>
      <link>https://www.servicenow.com/community/developer-forum/getting-values-from-multi-row-variable-set-record-producer/m-p/1405774#M62700</link>
      <description>&lt;P style="text-align: left;"&gt;Thanks Ankur, I am pretty close. I added a string variable to my MRVS to test&lt;/P&gt;
&lt;P style="text-align: left;"&gt;MRVS =&amp;nbsp;Other Contacts&lt;/P&gt;
&lt;P style="text-align: left;"&gt;variables = Name (reference to sys_id)&lt;/P&gt;
&lt;P style="text-align: left;"&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;test (string variable)&lt;/P&gt;
&lt;P style="text-align: left;"&gt;var contactArr = JSON.parse(producer.other_contacts);&lt;/P&gt;
&lt;P class="ng-scope"&gt;var contactCnt = producer.other_contacts.getRowCount();&lt;/P&gt;
&lt;P class="ng-scope"&gt;if (contactCnt &amp;gt; 0) {&lt;BR /&gt;&amp;nbsp; &amp;nbsp; for (i = 0; i &amp;lt; contactCnt; i++) {&lt;BR /&gt;&amp;nbsp; &amp;nbsp; var gr = new('related_record');&lt;BR /&gt;&amp;nbsp; &amp;nbsp; gr.initialize();&lt;/P&gt;
&lt;P class="ng-scope"&gt;&amp;nbsp; &amp;nbsp; gr.setValue('test',contactArr[i].test); &lt;SPAN style="color: #ff0000;"&gt;&amp;lt;--------- this works&lt;/SPAN&gt;&lt;BR /&gt;&amp;nbsp; &amp;nbsp;gr.setValue('name',contactArr[i].name);&amp;nbsp; &lt;SPAN style="color: #ff0000;"&gt;&lt;STRONG&gt;&amp;lt;------- this doesn't name is a reference variable?&lt;/STRONG&gt;&lt;/SPAN&gt;&lt;BR /&gt;&amp;nbsp; &amp;nbsp;database.insert();&lt;BR /&gt;&amp;nbsp;}&lt;BR /&gt;}&lt;/P&gt;</description>
      <pubDate>Sun, 17 May 2020 15:17:53 GMT</pubDate>
      <guid>https://www.servicenow.com/community/developer-forum/getting-values-from-multi-row-variable-set-record-producer/m-p/1405774#M62700</guid>
      <dc:creator>gregrice</dc:creator>
      <dc:date>2020-05-17T15:17:53Z</dc:date>
    </item>
    <item>
      <title>Re: Getting Values from Multi Row Variable Set Record Producer</title>
      <link>https://www.servicenow.com/community/developer-forum/getting-values-from-multi-row-variable-set-record-producer/m-p/1405775#M62701</link>
      <description>&lt;P&gt;It's working now. I deleted my variable and re-added not sure what the issue was.&lt;/P&gt;</description>
      <pubDate>Sun, 17 May 2020 15:48:09 GMT</pubDate>
      <guid>https://www.servicenow.com/community/developer-forum/getting-values-from-multi-row-variable-set-record-producer/m-p/1405775#M62701</guid>
      <dc:creator>gregrice</dc:creator>
      <dc:date>2020-05-17T15:48:09Z</dc:date>
    </item>
  </channel>
</rss>

