<?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: How to submit a catalog item in orderguide based on MRVS variables changes in Community Central forum</title>
    <link>https://www.servicenow.com/community/community-central-forum/how-to-submit-a-catalog-item-in-orderguide-based-on-mrvs/m-p/3053036#M943</link>
    <description>&lt;P&gt;If using an Order Guide yes/no variable named 'v_catalog_item' in an MRVS with the internal name 'application_mrvs' which has the application variable named 'v_application', this is what the onSubmit Catalog Client Script looks like:&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;LI-CODE lang="javascript"&gt;function onSubmit() {
	var cat_item = false;
	var mrvs = g_form.getValue('application_mrvs');
	if (mrvs.length &amp;gt; 2) { //native UI returns [] for empty MRVS value which causes a parsing error
		var obj = JSON.parse(mrvs);
		for (var i = 0; i &amp;lt; obj.length; i++) {
			if (obj[i].v_application == '&amp;lt;&amp;lt;sys_id or value of certain application&amp;gt;&amp;gt;') {
                cat_item = true;
                break; //we found one, so no need to continue
            }
		}
	}
    if (cat_item) {	
        g_form.setValue('v_catalog_item', 'Yes');
    }
}&lt;/LI-CODE&gt;
&lt;P&gt;Rule Base example&lt;/P&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="BradBowman_0-1727093870555.png" style="width: 400px;"&gt;&lt;img src="https://www.servicenow.com/community/image/serverpage/image-id/388427iEC559E18D9FEC50F/image-size/medium/is-moderation-mode/true?v=v2&amp;amp;px=400" role="button" title="BradBowman_0-1727093870555.png" alt="BradBowman_0-1727093870555.png" /&gt;&lt;/span&gt;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
    <pubDate>Mon, 23 Sep 2024 12:18:43 GMT</pubDate>
    <dc:creator>Brad Bowman</dc:creator>
    <dc:date>2024-09-23T12:18:43Z</dc:date>
    <item>
      <title>How to submit a catalog item in orderguide based on MRVS variables changes</title>
      <link>https://www.servicenow.com/community/community-central-forum/how-to-submit-a-catalog-item-in-orderguide-based-on-mrvs/m-p/3052581#M936</link>
      <description>&lt;P&gt;Hi all,&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I need to submit a catalog item in the order guide. In the order guide we have MRVS variable which has variables of application. If application is value set to Value1. Then Catalog item 1 need to submitted.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;But to achieve this I tried to add the rule base , but it's not support to add rule base for MRVS variable.&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;How can I achieve this? Can someone suggest on this.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Thanks in advance&lt;/P&gt;</description>
      <pubDate>Mon, 23 Sep 2024 09:11:10 GMT</pubDate>
      <guid>https://www.servicenow.com/community/community-central-forum/how-to-submit-a-catalog-item-in-orderguide-based-on-mrvs/m-p/3052581#M936</guid>
      <dc:creator>Nagendra Babu32</dc:creator>
      <dc:date>2024-09-23T09:11:10Z</dc:date>
    </item>
    <item>
      <title>Re: How to submit a catalog item in orderguide based on MRVS variables changes</title>
      <link>https://www.servicenow.com/community/community-central-forum/how-to-submit-a-catalog-item-in-orderguide-based-on-mrvs/m-p/3052913#M939</link>
      <description>&lt;P&gt;What you need to do is create an Order Guide variable with a unique name so it doesn't cascade to the Catalog Item(s).&amp;nbsp; Let's make this a yes/no variable for this example, but you can choose a different type once you see the approach.&amp;nbsp; You can hide this variable on the request form,... so that it doesn't show anywhere.&amp;nbsp; In an onSubmit Catalog Client Script that applies to the Catalog Item = the Order Guide (OG onSubmit scripts run when the Choose Options / next button is clicked) you would write a script that retrieves the contents of the MRVS, then loops through them to test if any row has an application 'is value set to Value1'.&amp;nbsp; If it finds on, set the yes/no variable to 'Yes'.&amp;nbsp; Then you would add or change the Rule Base to include Catalog item 1 with the condition &amp;lt;&amp;lt;new variable name&amp;gt;&amp;gt; is Yes.&lt;/P&gt;</description>
      <pubDate>Mon, 23 Sep 2024 10:40:10 GMT</pubDate>
      <guid>https://www.servicenow.com/community/community-central-forum/how-to-submit-a-catalog-item-in-orderguide-based-on-mrvs/m-p/3052913#M939</guid>
      <dc:creator>Brad Bowman</dc:creator>
      <dc:date>2024-09-23T10:40:10Z</dc:date>
    </item>
    <item>
      <title>Re: How to submit a catalog item in orderguide based on MRVS variables changes</title>
      <link>https://www.servicenow.com/community/community-central-forum/how-to-submit-a-catalog-item-in-orderguide-based-on-mrvs/m-p/3052945#M941</link>
      <description>&lt;P&gt;Hello&amp;nbsp;&lt;a href="https://www.servicenow.com/community/user/viewprofilepage/user-id/174062"&gt;@Brad Bowman &lt;/a&gt;&amp;nbsp;,&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Thanks for your reply. Can you elaborate it?&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Mon, 23 Sep 2024 11:11:18 GMT</pubDate>
      <guid>https://www.servicenow.com/community/community-central-forum/how-to-submit-a-catalog-item-in-orderguide-based-on-mrvs/m-p/3052945#M941</guid>
      <dc:creator>Nagendra Babu32</dc:creator>
      <dc:date>2024-09-23T11:11:18Z</dc:date>
    </item>
    <item>
      <title>Re: How to submit a catalog item in orderguide based on MRVS variables changes</title>
      <link>https://www.servicenow.com/community/community-central-forum/how-to-submit-a-catalog-item-in-orderguide-based-on-mrvs/m-p/3052975#M942</link>
      <description>&lt;P&gt;hi&amp;nbsp;&lt;a href="https://www.servicenow.com/community/user/viewprofilepage/user-id/573641"&gt;@Nagendra Babu32&lt;/a&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Add an "onSubmit" catalog client script to the order guide. This script will loop through the MRVS data and check the values of the "application" variable.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;sample code of client script, make changes as per your requirement here:&lt;/P&gt;&lt;LI-CODE lang="javascript"&gt;function onSubmit() {
    var mrvField = g_form.getValue('your_mrvs_variable');
    var mrvData = JSON.parse(mrvField); // Parse the MRVS JSON data

    var shouldSubmitItem1 = false;

    // Loop through the MRVS rows to find the application value
    for (var i = 0; i &amp;lt; mrvData.length; i++) {
        var applicationValue = mrvData[i].application; // Adjust the field name to match your MRVS

        if (applicationValue == 'Value1') {
            shouldSubmitItem1 = true;
            break;
        }
    }

    // Submit the Catalog Item 1 based on the condition
    if (shouldSubmitItem1) {
        // Use g_form.submit or custom logic to submit the required catalog item
        submitCatalogItem1();
    }
}

function submitCatalogItem1() {
    // Custom logic to submit Catalog Item 1 programmatically
    // This might involve using GlideAjax to trigger a server-side process
}&lt;/LI-CODE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;i hope my answer helps you to resolve your issue, if yes please mark my answer helpful and correct.&lt;/P&gt;&lt;P&gt;thank you&lt;/P&gt;&lt;P&gt;rajesh&lt;/P&gt;</description>
      <pubDate>Mon, 23 Sep 2024 11:30:49 GMT</pubDate>
      <guid>https://www.servicenow.com/community/community-central-forum/how-to-submit-a-catalog-item-in-orderguide-based-on-mrvs/m-p/3052975#M942</guid>
      <dc:creator>Rajesh Chopade1</dc:creator>
      <dc:date>2024-09-23T11:30:49Z</dc:date>
    </item>
    <item>
      <title>Re: How to submit a catalog item in orderguide based on MRVS variables changes</title>
      <link>https://www.servicenow.com/community/community-central-forum/how-to-submit-a-catalog-item-in-orderguide-based-on-mrvs/m-p/3053036#M943</link>
      <description>&lt;P&gt;If using an Order Guide yes/no variable named 'v_catalog_item' in an MRVS with the internal name 'application_mrvs' which has the application variable named 'v_application', this is what the onSubmit Catalog Client Script looks like:&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;LI-CODE lang="javascript"&gt;function onSubmit() {
	var cat_item = false;
	var mrvs = g_form.getValue('application_mrvs');
	if (mrvs.length &amp;gt; 2) { //native UI returns [] for empty MRVS value which causes a parsing error
		var obj = JSON.parse(mrvs);
		for (var i = 0; i &amp;lt; obj.length; i++) {
			if (obj[i].v_application == '&amp;lt;&amp;lt;sys_id or value of certain application&amp;gt;&amp;gt;') {
                cat_item = true;
                break; //we found one, so no need to continue
            }
		}
	}
    if (cat_item) {	
        g_form.setValue('v_catalog_item', 'Yes');
    }
}&lt;/LI-CODE&gt;
&lt;P&gt;Rule Base example&lt;/P&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="BradBowman_0-1727093870555.png" style="width: 400px;"&gt;&lt;img src="https://www.servicenow.com/community/image/serverpage/image-id/388427iEC559E18D9FEC50F/image-size/medium/is-moderation-mode/true?v=v2&amp;amp;px=400" role="button" title="BradBowman_0-1727093870555.png" alt="BradBowman_0-1727093870555.png" /&gt;&lt;/span&gt;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Mon, 23 Sep 2024 12:18:43 GMT</pubDate>
      <guid>https://www.servicenow.com/community/community-central-forum/how-to-submit-a-catalog-item-in-orderguide-based-on-mrvs/m-p/3053036#M943</guid>
      <dc:creator>Brad Bowman</dc:creator>
      <dc:date>2024-09-23T12:18:43Z</dc:date>
    </item>
  </channel>
</rss>

