<?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 create MRVS records with some array data in Community Central forum</title>
    <link>https://www.servicenow.com/community/community-central-forum/create-mrvs-records-with-some-array-data/m-p/3049480#M906</link>
    <description>&lt;P&gt;i have data with array as below&lt;/P&gt;&lt;P&gt;[{ "meterialID:"1220000", "DescriptionID": "tandard qa", "Quantity": 1 },{ "meterialID:"1220000", "DescriptionID": "tandard qa", "Quantity": 1 }]&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;i want add records in catalog MRVS variable set while submitting catalog through script or flow designer.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Please share any ideas....&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
    <pubDate>Thu, 19 Sep 2024 04:51:39 GMT</pubDate>
    <dc:creator>Community Alums</dc:creator>
    <dc:date>2024-09-19T04:51:39Z</dc:date>
    <item>
      <title>create MRVS records with some array data</title>
      <link>https://www.servicenow.com/community/community-central-forum/create-mrvs-records-with-some-array-data/m-p/3049480#M906</link>
      <description>&lt;P&gt;i have data with array as below&lt;/P&gt;&lt;P&gt;[{ "meterialID:"1220000", "DescriptionID": "tandard qa", "Quantity": 1 },{ "meterialID:"1220000", "DescriptionID": "tandard qa", "Quantity": 1 }]&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;i want add records in catalog MRVS variable set while submitting catalog through script or flow designer.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Please share any ideas....&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Thu, 19 Sep 2024 04:51:39 GMT</pubDate>
      <guid>https://www.servicenow.com/community/community-central-forum/create-mrvs-records-with-some-array-data/m-p/3049480#M906</guid>
      <dc:creator>Community Alums</dc:creator>
      <dc:date>2024-09-19T04:51:39Z</dc:date>
    </item>
    <item>
      <title>Re: create MRVS records with some array data</title>
      <link>https://www.servicenow.com/community/community-central-forum/create-mrvs-records-with-some-array-data/m-p/3049483#M907</link>
      <description>&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;H3&gt;Using a Catalog Client Script&lt;/H3&gt;
&lt;OL&gt;
&lt;LI&gt;
&lt;P&gt;&lt;STRONG&gt;Ensure your variable set is set up&lt;/STRONG&gt;: Make sure you have an MRVS variable set defined in your catalog item.&lt;/P&gt;
&lt;/LI&gt;
&lt;LI&gt;
&lt;P&gt;&lt;STRONG&gt;Use a Catalog Client Script&lt;/STRONG&gt;: You can create a Catalog Client Script that processes the input data and populates the MRVS. Here’s a sample script you might use:&lt;/P&gt;
&lt;/LI&gt;
&lt;/OL&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;DIV class="dark bg-gray-950 contain-inline-size rounded-md border-[0.5px] border-token-border-medium relative"&gt;&amp;nbsp;&lt;/DIV&gt;
&lt;LI-CODE lang="markup"&gt;function addToMRVS() {
    var data = [
        { "meterialID": "1220000", "DescriptionID": "tandard qa", "Quantity": 1 },
        { "meterialID": "1220000", "DescriptionID": "tandard qa", "Quantity": 1 }
    ];

    // Get the MRVS variable name
    var mrvsVariableName = 'your_mrvs_variable_name'; // Replace with your actual variable name

    // Loop through the array and add records to the MRVS
    data.forEach(function(item) {
        // Create a new record in the MRVS
        var newRecord = {
            "meterialID": item.meterialID,
            "DescriptionID": item.DescriptionID,
            "Quantity": item.Quantity
        };
        
        // Push the new record to the MRVS
        g_form.addOption(mrvsVariableName, newRecord);
    });
}

// Call the function to add records when the form loads
addToMRVS();

&lt;/LI-CODE&gt;
&lt;H3&gt;Using Flow Designer&lt;/H3&gt;
&lt;OL&gt;
&lt;LI&gt;
&lt;P&gt;&lt;STRONG&gt;Create a Flow&lt;/STRONG&gt;: In Flow Designer, create a new Flow and use the trigger that suits your needs (e.g., when a catalog item is requested).&lt;/P&gt;
&lt;/LI&gt;
&lt;LI&gt;
&lt;P&gt;&lt;STRONG&gt;Add Action&lt;/STRONG&gt;: Use the "Create Record" action to create multiple records in the MRVS.&lt;/P&gt;
&lt;/LI&gt;
&lt;LI&gt;
&lt;P&gt;&lt;STRONG&gt;Loop through your data&lt;/STRONG&gt;: Use a "For Each" action to iterate over the array of data. In each iteration, create a new record in the MRVS variable set.&lt;/P&gt;
&lt;/LI&gt;
&lt;LI&gt;
&lt;P&gt;&lt;STRONG&gt;Map your fields&lt;/STRONG&gt;: Map the fields from your array to the fields in your MRVS. This is typically done by selecting the appropriate variable names in the action configuration.&lt;/P&gt;
&lt;/LI&gt;
&lt;/OL&gt;</description>
      <pubDate>Thu, 19 Sep 2024 04:55:59 GMT</pubDate>
      <guid>https://www.servicenow.com/community/community-central-forum/create-mrvs-records-with-some-array-data/m-p/3049483#M907</guid>
      <dc:creator>Vaishnavi Lathk</dc:creator>
      <dc:date>2024-09-19T04:55:59Z</dc:date>
    </item>
    <item>
      <title>Re: create MRVS records with some array data</title>
      <link>https://www.servicenow.com/community/community-central-forum/create-mrvs-records-with-some-array-data/m-p/3049496#M908</link>
      <description>&lt;P&gt;Thanks for quick reply. unfortunately client script didn't work for me.&lt;/P&gt;</description>
      <pubDate>Thu, 19 Sep 2024 05:13:31 GMT</pubDate>
      <guid>https://www.servicenow.com/community/community-central-forum/create-mrvs-records-with-some-array-data/m-p/3049496#M908</guid>
      <dc:creator>Community Alums</dc:creator>
      <dc:date>2024-09-19T05:13:31Z</dc:date>
    </item>
    <item>
      <title>Re: create MRVS records with some array data</title>
      <link>https://www.servicenow.com/community/community-central-forum/create-mrvs-records-with-some-array-data/m-p/3049498#M909</link>
      <description>&lt;PRE&gt;g_form.addOption(mrvsVariableName, newRecord);&amp;nbsp;&lt;/PRE&gt;&lt;P&gt;Might be this is not working....&lt;/P&gt;</description>
      <pubDate>Thu, 19 Sep 2024 05:15:59 GMT</pubDate>
      <guid>https://www.servicenow.com/community/community-central-forum/create-mrvs-records-with-some-array-data/m-p/3049498#M909</guid>
      <dc:creator>Community Alums</dc:creator>
      <dc:date>2024-09-19T05:15:59Z</dc:date>
    </item>
  </channel>
</rss>

