<?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>post Set values in a Multi Row Variable Set (MRVS). in Developer articles</title>
    <link>https://www.servicenow.com/community/developer-articles/set-values-in-a-multi-row-variable-set-mrvs/ta-p/2510137</link>
    <description>&lt;P&gt;&lt;SPAN&gt;Hi there,&lt;/SPAN&gt;&lt;/P&gt;
&lt;P&gt;&lt;SPAN&gt;Hope you are doing well..!&lt;/SPAN&gt;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&lt;SPAN&gt;The following article is intended to help people to &lt;/SPAN&gt;&lt;STRONG&gt;set &lt;/STRONG&gt;&lt;SPAN&gt;values within a &lt;/SPAN&gt;&lt;STRONG&gt;Multi Row Variable Set (MRVS) &lt;/STRONG&gt;&lt;SPAN&gt;based on value(s) set on a variable on the catalog item.&lt;/SPAN&gt;&lt;/P&gt;
&lt;P&gt;&lt;SPAN&gt;&amp;nbsp;&lt;/SPAN&gt;&lt;/P&gt;
&lt;P&gt;&lt;SPAN&gt;Let's get started, here we will be using &lt;/SPAN&gt;&lt;STRONG&gt;g_service_catalog &lt;/STRONG&gt;&lt;SPAN&gt;API&lt;/SPAN&gt;&lt;STRONG&gt;.&lt;/STRONG&gt;&lt;/P&gt;
&lt;P&gt;&lt;STRONG&gt;g_service_catalog &lt;/STRONG&gt;&lt;SPAN&gt;is a client-side API that enables accessing data of variables in catalog items to a multi-row variable set (MRVS) when a model is open. This API is available in all environments, such as Service Portal, Now Platform, Workspace, and Now® Mobile.&lt;/SPAN&gt;&lt;/P&gt;
&lt;P&gt;&lt;SPAN&gt;&amp;nbsp;&lt;/SPAN&gt;&lt;/P&gt;
&lt;P&gt;&lt;SPAN&gt;Result:&lt;/SPAN&gt;&lt;/P&gt;
&lt;P&gt;&lt;SPAN&gt;Let's just start with the end result that we are trying to achieve. When a user input some value on the catalog item variable same should be set/copied to the MRVS variable.&lt;/SPAN&gt;&lt;/P&gt;
&lt;P&gt;&lt;SPAN&gt;&amp;nbsp;&lt;/SPAN&gt;&lt;/P&gt;
&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="HemantGoldar_2-1679209445209.png" style="width: 659px;"&gt;&lt;img src="https://www.servicenow.com/community/image/serverpage/image-id/248394i7CCB886331F3ABAD/image-dimensions/659x275?v=v2" srcset="/community/image/serverpage/image-id/248394i7CCB886331F3ABAD/image-dimensions/659x275?v=v2 1.0x, /community/image/serverpage/image-id/248394i7CCB886331F3ABAD/image-dimensions/1318x549?v=v2 2.0x, /community/image/serverpage/image-id/248394i7CCB886331F3ABAD/image-dimensions/1977x824?v=v2 3.0x" width="659" height="275" role="button" title="HemantGoldar_2-1679209445209.png" alt="HemantGoldar_2-1679209445209.png" /&gt;&lt;/span&gt;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&lt;SPAN&gt;Here we have to use the OnLoad Catalog client script in MRVS as below.&lt;/SPAN&gt;&lt;/P&gt;
&lt;P&gt;&lt;SPAN&gt;&lt;EM&gt;question1&lt;/EM&gt; is a variable of the Catalog item.&lt;/SPAN&gt;&lt;/P&gt;
&lt;P&gt;&lt;SPAN&gt;&lt;EM&gt;multiquestion1&lt;/EM&gt; is a variable of MRVS.&lt;/SPAN&gt;&lt;/P&gt;
&lt;LI-CODE lang="markup"&gt;function onLoad() {
    //Type appropriate comment here, and begin script below multiquestion1
    //get field value of the variable in catalog item 
	var getValueQue1 = g_service_catalog.parent.getValue('question1');	
	if(getValueQue1){
    //set field value to MRVS variable
    g_form.setValue('multiquestion1',getValueQue1);}
}
&lt;/LI-CODE&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="HemantGoldar_1-1679209309000.png" style="width: 640px;"&gt;&lt;img src="https://www.servicenow.com/community/image/serverpage/image-id/248393iD1111E827F74422B/image-dimensions/640x339?v=v2" srcset="/community/image/serverpage/image-id/248393iD1111E827F74422B/image-dimensions/640x339?v=v2 1.0x, /community/image/serverpage/image-id/248393iD1111E827F74422B/image-dimensions/1278x678?v=v2 2.0x, /community/image/serverpage/image-id/248393iD1111E827F74422B/image-dimensions/1917x1017?v=v2 3.0x" width="640" height="339" role="button" title="HemantGoldar_1-1679209309000.png" alt="HemantGoldar_1-1679209309000.png" /&gt;&lt;/span&gt;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&lt;SPAN&gt;If this post helped you in any way, I would appreciate it if you hit&amp;nbsp;&lt;/SPAN&gt;&lt;STRONG&gt;bookmark&lt;/STRONG&gt;&lt;SPAN&gt;&amp;nbsp;or mark it as&amp;nbsp;&lt;/SPAN&gt;&lt;STRONG&gt;helpful&lt;/STRONG&gt;&lt;SPAN&gt;.&lt;/SPAN&gt;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&lt;SPAN&gt;Regards,&lt;/SPAN&gt;&lt;/P&gt;
&lt;P&gt;&lt;SPAN&gt;Hemant Goldar&lt;/SPAN&gt;&lt;/P&gt;</description>
    <pubDate>Sun, 19 Mar 2023 08:00:00 GMT</pubDate>
    <dc:creator>Hemant Goldar</dc:creator>
    <dc:date>2023-03-19T08:00:00Z</dc:date>
    <item>
      <title>Set values in a Multi Row Variable Set (MRVS).</title>
      <link>https://www.servicenow.com/community/developer-articles/set-values-in-a-multi-row-variable-set-mrvs/ta-p/2510137</link>
      <description>&lt;P&gt;&lt;SPAN&gt;Hi there,&lt;/SPAN&gt;&lt;/P&gt;
&lt;P&gt;&lt;SPAN&gt;Hope you are doing well..!&lt;/SPAN&gt;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&lt;SPAN&gt;The following article is intended to help people to &lt;/SPAN&gt;&lt;STRONG&gt;set &lt;/STRONG&gt;&lt;SPAN&gt;values within a &lt;/SPAN&gt;&lt;STRONG&gt;Multi Row Variable Set (MRVS) &lt;/STRONG&gt;&lt;SPAN&gt;based on value(s) set on a variable on the catalog item.&lt;/SPAN&gt;&lt;/P&gt;
&lt;P&gt;&lt;SPAN&gt;&amp;nbsp;&lt;/SPAN&gt;&lt;/P&gt;
&lt;P&gt;&lt;SPAN&gt;Let's get started, here we will be using &lt;/SPAN&gt;&lt;STRONG&gt;g_service_catalog &lt;/STRONG&gt;&lt;SPAN&gt;API&lt;/SPAN&gt;&lt;STRONG&gt;.&lt;/STRONG&gt;&lt;/P&gt;
&lt;P&gt;&lt;STRONG&gt;g_service_catalog &lt;/STRONG&gt;&lt;SPAN&gt;is a client-side API that enables accessing data of variables in catalog items to a multi-row variable set (MRVS) when a model is open. This API is available in all environments, such as Service Portal, Now Platform, Workspace, and Now® Mobile.&lt;/SPAN&gt;&lt;/P&gt;
&lt;P&gt;&lt;SPAN&gt;&amp;nbsp;&lt;/SPAN&gt;&lt;/P&gt;
&lt;P&gt;&lt;SPAN&gt;Result:&lt;/SPAN&gt;&lt;/P&gt;
&lt;P&gt;&lt;SPAN&gt;Let's just start with the end result that we are trying to achieve. When a user input some value on the catalog item variable same should be set/copied to the MRVS variable.&lt;/SPAN&gt;&lt;/P&gt;
&lt;P&gt;&lt;SPAN&gt;&amp;nbsp;&lt;/SPAN&gt;&lt;/P&gt;
&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="HemantGoldar_2-1679209445209.png" style="width: 659px;"&gt;&lt;img src="https://www.servicenow.com/community/image/serverpage/image-id/248394i7CCB886331F3ABAD/image-dimensions/659x275?v=v2" srcset="/community/image/serverpage/image-id/248394i7CCB886331F3ABAD/image-dimensions/659x275?v=v2 1.0x, /community/image/serverpage/image-id/248394i7CCB886331F3ABAD/image-dimensions/1318x549?v=v2 2.0x, /community/image/serverpage/image-id/248394i7CCB886331F3ABAD/image-dimensions/1977x824?v=v2 3.0x" width="659" height="275" role="button" title="HemantGoldar_2-1679209445209.png" alt="HemantGoldar_2-1679209445209.png" /&gt;&lt;/span&gt;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&lt;SPAN&gt;Here we have to use the OnLoad Catalog client script in MRVS as below.&lt;/SPAN&gt;&lt;/P&gt;
&lt;P&gt;&lt;SPAN&gt;&lt;EM&gt;question1&lt;/EM&gt; is a variable of the Catalog item.&lt;/SPAN&gt;&lt;/P&gt;
&lt;P&gt;&lt;SPAN&gt;&lt;EM&gt;multiquestion1&lt;/EM&gt; is a variable of MRVS.&lt;/SPAN&gt;&lt;/P&gt;
&lt;LI-CODE lang="markup"&gt;function onLoad() {
    //Type appropriate comment here, and begin script below multiquestion1
    //get field value of the variable in catalog item 
	var getValueQue1 = g_service_catalog.parent.getValue('question1');	
	if(getValueQue1){
    //set field value to MRVS variable
    g_form.setValue('multiquestion1',getValueQue1);}
}
&lt;/LI-CODE&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="HemantGoldar_1-1679209309000.png" style="width: 640px;"&gt;&lt;img src="https://www.servicenow.com/community/image/serverpage/image-id/248393iD1111E827F74422B/image-dimensions/640x339?v=v2" srcset="/community/image/serverpage/image-id/248393iD1111E827F74422B/image-dimensions/640x339?v=v2 1.0x, /community/image/serverpage/image-id/248393iD1111E827F74422B/image-dimensions/1278x678?v=v2 2.0x, /community/image/serverpage/image-id/248393iD1111E827F74422B/image-dimensions/1917x1017?v=v2 3.0x" width="640" height="339" role="button" title="HemantGoldar_1-1679209309000.png" alt="HemantGoldar_1-1679209309000.png" /&gt;&lt;/span&gt;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&lt;SPAN&gt;If this post helped you in any way, I would appreciate it if you hit&amp;nbsp;&lt;/SPAN&gt;&lt;STRONG&gt;bookmark&lt;/STRONG&gt;&lt;SPAN&gt;&amp;nbsp;or mark it as&amp;nbsp;&lt;/SPAN&gt;&lt;STRONG&gt;helpful&lt;/STRONG&gt;&lt;SPAN&gt;.&lt;/SPAN&gt;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&lt;SPAN&gt;Regards,&lt;/SPAN&gt;&lt;/P&gt;
&lt;P&gt;&lt;SPAN&gt;Hemant Goldar&lt;/SPAN&gt;&lt;/P&gt;</description>
      <pubDate>Sun, 19 Mar 2023 08:00:00 GMT</pubDate>
      <guid>https://www.servicenow.com/community/developer-articles/set-values-in-a-multi-row-variable-set-mrvs/ta-p/2510137</guid>
      <dc:creator>Hemant Goldar</dc:creator>
      <dc:date>2023-03-19T08:00:00Z</dc:date>
    </item>
    <item>
      <title>Re: Set values in a Multi Row Variable Set (MRVS).</title>
      <link>https://www.servicenow.com/community/developer-articles/set-values-in-a-multi-row-variable-set-mrvs/tac-p/2670379#M7952</link>
      <description>&lt;P&gt;Hi Hemant,&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I have created username(reference field) in MRVS .when I tried to map this field to description of req_item and task using flow designer .but it showing sys id instead of username .&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;please let me know how to set value using client script&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Wed, 13 Sep 2023 13:50:44 GMT</pubDate>
      <guid>https://www.servicenow.com/community/developer-articles/set-values-in-a-multi-row-variable-set-mrvs/tac-p/2670379#M7952</guid>
      <dc:creator>nandhini muthu</dc:creator>
      <dc:date>2023-09-13T13:50:44Z</dc:date>
    </item>
    <item>
      <title>Re: Set values in a Multi Row Variable Set (MRVS).</title>
      <link>https://www.servicenow.com/community/developer-articles/set-values-in-a-multi-row-variable-set-mrvs/tac-p/2670556#M7953</link>
      <description>&lt;P&gt;Please let me know how to get username from MRVS variable .&lt;/P&gt;</description>
      <pubDate>Wed, 13 Sep 2023 15:24:00 GMT</pubDate>
      <guid>https://www.servicenow.com/community/developer-articles/set-values-in-a-multi-row-variable-set-mrvs/tac-p/2670556#M7953</guid>
      <dc:creator>nandhini muthu</dc:creator>
      <dc:date>2023-09-13T15:24:00Z</dc:date>
    </item>
    <item>
      <title>Re: Set values in a Multi Row Variable Set (MRVS).</title>
      <link>https://www.servicenow.com/community/developer-articles/set-values-in-a-multi-row-variable-set-mrvs/tac-p/2813965#M8730</link>
      <description>&lt;P&gt;Great, that was exactly what I needed to make some variables inside a Variable Set mandatory based on values from the Catalog Item, my IF statement was exactly like in your screenshot, just instead of setValue I used setMandatory&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Thank you &lt;span class="lia-unicode-emoji" title=":slightly_smiling_face:"&gt;🙂&lt;/span&gt;&lt;/P&gt;</description>
      <pubDate>Fri, 02 Feb 2024 20:51:01 GMT</pubDate>
      <guid>https://www.servicenow.com/community/developer-articles/set-values-in-a-multi-row-variable-set-mrvs/tac-p/2813965#M8730</guid>
      <dc:creator>hmadureira</dc:creator>
      <dc:date>2024-02-02T20:51:01Z</dc:date>
    </item>
    <item>
      <title>Re: Set values in a Multi Row Variable Set (MRVS).</title>
      <link>https://www.servicenow.com/community/developer-articles/set-values-in-a-multi-row-variable-set-mrvs/tac-p/3263053#M10304</link>
      <description>&lt;P&gt;hi&amp;nbsp;&lt;a href="https://www.servicenow.com/community/user/viewprofilepage/user-id/443796"&gt;@Hemant Goldar&lt;/a&gt;&amp;nbsp;,&lt;/P&gt;&lt;P&gt;i have the similer kind of requriment where&lt;/P&gt;&lt;P&gt;I want to hide the variable inside the variable set depending on the variable outside of the variable set.&lt;/P&gt;&lt;P&gt;have tried with same script but still same issue its showing for every choice field.&amp;nbsp;&lt;/P&gt;&lt;P&gt;below is the script written inside of the MRVS :&lt;/P&gt;&lt;P&gt;this_is_regarding is the choice field (outside of MRVS) on change of if when someone select type_b&amp;nbsp;&lt;/P&gt;&lt;P&gt;then only select_choice field inside of the MRVS should be visible and for other choice it should not be visible ;&lt;/P&gt;&lt;P&gt;&amp;nbsp;but its not working&amp;nbsp;&lt;/P&gt;&lt;LI-CODE lang="javascript"&gt;function onLoad() {
    //Type appropriate comment here, and begin script below

    var applicationType = g_service_catalog.parent.getValue("this_is_regarding");

    if (applicationType == 'type_b') // give the choice value to compare
        g_form.setDisplay('select_choice', false);
}&lt;/LI-CODE&gt;&lt;P&gt;ss is attached for your reference :&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="Screenshot (117).png" style="width: 400px;"&gt;&lt;img src="https://www.servicenow.com/community/image/serverpage/image-id/442089i6EB4474ABA56CEE8/image-size/medium?v=v2&amp;amp;px=400" srcset="/community/image/serverpage/image-id/442089i6EB4474ABA56CEE8/image-size/medium?v=v2&amp;amp;px=400 1.0x, /community/image/serverpage/image-id/442089i6EB4474ABA56CEE8/image-dimensions/800x450?v=v2 2.0x, /community/image/serverpage/image-id/442089i6EB4474ABA56CEE8/image-dimensions/1200x675?v=v2 3.0x" role="button" title="Screenshot (117).png" alt="Screenshot (117).png" /&gt;&lt;/span&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="Screenshot (118).png" style="width: 400px;"&gt;&lt;img src="https://www.servicenow.com/community/image/serverpage/image-id/442091iF167A8B61FF58A2D/image-size/medium?v=v2&amp;amp;px=400" srcset="/community/image/serverpage/image-id/442091iF167A8B61FF58A2D/image-size/medium?v=v2&amp;amp;px=400 1.0x, /community/image/serverpage/image-id/442091iF167A8B61FF58A2D/image-dimensions/800x450?v=v2 2.0x, /community/image/serverpage/image-id/442091iF167A8B61FF58A2D/image-dimensions/1200x675?v=v2 3.0x" role="button" title="Screenshot (118).png" alt="Screenshot (118).png" /&gt;&lt;/span&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="Screenshot (119).png" style="width: 400px;"&gt;&lt;img src="https://www.servicenow.com/community/image/serverpage/image-id/442090i9F7CA03CFED00526/image-size/medium?v=v2&amp;amp;px=400" srcset="/community/image/serverpage/image-id/442090i9F7CA03CFED00526/image-size/medium?v=v2&amp;amp;px=400 1.0x, /community/image/serverpage/image-id/442090i9F7CA03CFED00526/image-dimensions/800x450?v=v2 2.0x, /community/image/serverpage/image-id/442090i9F7CA03CFED00526/image-dimensions/1200x675?v=v2 3.0x" role="button" title="Screenshot (119).png" alt="Screenshot (119).png" /&gt;&lt;/span&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;can you please help!!&lt;/P&gt;&lt;P&gt;thanks!!&lt;/P&gt;</description>
      <pubDate>Wed, 14 May 2025 09:23:55 GMT</pubDate>
      <guid>https://www.servicenow.com/community/developer-articles/set-values-in-a-multi-row-variable-set-mrvs/tac-p/3263053#M10304</guid>
      <dc:creator>tushar_ghadage</dc:creator>
      <dc:date>2025-05-14T09:23:55Z</dc:date>
    </item>
  </channel>
</rss>

