<?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 we can set the variables on catalog item form from UI action. in Service Management forum</title>
    <link>https://www.servicenow.com/community/service-management-forum/how-we-can-set-the-variables-on-catalog-item-form-from-ui-action/m-p/2667994#M35029</link>
    <description>&lt;P&gt;&lt;a href="https://www.servicenow.com/community/user/viewprofilepage/user-id/209175"&gt;@Peter Wood&lt;/a&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;another catalog item form opens in new tab&lt;/P&gt;
&lt;P&gt;So you need to redirect the user and pass the values in URL and then use onLoad catalog client script on that redirected catalog item and populate it&lt;/P&gt;
&lt;P&gt;check this link and it will solve your query; but please enhance it as per your requirement&lt;/P&gt;
&lt;P&gt;&lt;A href="http://www.servicenowguru.com/scripting/client-scripts-scripting/parse-url-parameters-client-script/" target="_blank" rel="noopener"&gt;http://www.servicenowguru.com/scripting/client-scripts-scripting/parse-url-parameters-client-script/&lt;/A&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&lt;A href="https://www.servicenow.com/community/developer-blog/3-ways-to-populate-values-in-servicenow-via-the-url/ba-p/2266518" target="_blank" rel="noopener"&gt;3 Ways to Populate Values in ServiceNow via the URL&lt;/A&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Steps&lt;/P&gt;
&lt;P&gt;1) make your UI action client side or server side and include the form fields values or variables values in URL and include as parameter&lt;/P&gt;
&lt;P&gt;2) then parse and populate&lt;/P&gt;
&lt;P&gt;If my response helped please mark it correct and close the thread so that it benefits future readers.&lt;/P&gt;</description>
    <pubDate>Mon, 11 Sep 2023 15:25:17 GMT</pubDate>
    <dc:creator>Ankur Bawiskar</dc:creator>
    <dc:date>2023-09-11T15:25:17Z</dc:date>
    <item>
      <title>How we can set the variables on catalog item form from UI action.</title>
      <link>https://www.servicenow.com/community/service-management-forum/how-we-can-set-the-variables-on-catalog-item-form-from-ui-action/m-p/2667982#M35028</link>
      <description>&lt;P&gt;We have one catalog item where users are filling some variables and submitting the request, Once it is submitted one task will be generated for that request and on same task form we have one UI action, Whenever user clicks on UI action another catalog item form opens up in new tab and there we want to set the variable values from the task where we have UI action available.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;e.g - User will raise the 'ABC' catalog item and one task will be generated for 'ABC' catalog item, On that task we have one UI action 'Create Request'. Whenever user clicks on it new catalog item form 'PQR' will open and there we want to set the variable values from 'ABC' catalog item task.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;How we can achieve this.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Thanks.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Mon, 11 Sep 2023 15:10:03 GMT</pubDate>
      <guid>https://www.servicenow.com/community/service-management-forum/how-we-can-set-the-variables-on-catalog-item-form-from-ui-action/m-p/2667982#M35028</guid>
      <dc:creator>Peter Wood</dc:creator>
      <dc:date>2023-09-11T15:10:03Z</dc:date>
    </item>
    <item>
      <title>Re: How we can set the variables on catalog item form from UI action.</title>
      <link>https://www.servicenow.com/community/service-management-forum/how-we-can-set-the-variables-on-catalog-item-form-from-ui-action/m-p/2667994#M35029</link>
      <description>&lt;P&gt;&lt;a href="https://www.servicenow.com/community/user/viewprofilepage/user-id/209175"&gt;@Peter Wood&lt;/a&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;another catalog item form opens in new tab&lt;/P&gt;
&lt;P&gt;So you need to redirect the user and pass the values in URL and then use onLoad catalog client script on that redirected catalog item and populate it&lt;/P&gt;
&lt;P&gt;check this link and it will solve your query; but please enhance it as per your requirement&lt;/P&gt;
&lt;P&gt;&lt;A href="http://www.servicenowguru.com/scripting/client-scripts-scripting/parse-url-parameters-client-script/" target="_blank" rel="noopener"&gt;http://www.servicenowguru.com/scripting/client-scripts-scripting/parse-url-parameters-client-script/&lt;/A&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&lt;A href="https://www.servicenow.com/community/developer-blog/3-ways-to-populate-values-in-servicenow-via-the-url/ba-p/2266518" target="_blank" rel="noopener"&gt;3 Ways to Populate Values in ServiceNow via the URL&lt;/A&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Steps&lt;/P&gt;
&lt;P&gt;1) make your UI action client side or server side and include the form fields values or variables values in URL and include as parameter&lt;/P&gt;
&lt;P&gt;2) then parse and populate&lt;/P&gt;
&lt;P&gt;If my response helped please mark it correct and close the thread so that it benefits future readers.&lt;/P&gt;</description>
      <pubDate>Mon, 11 Sep 2023 15:25:17 GMT</pubDate>
      <guid>https://www.servicenow.com/community/service-management-forum/how-we-can-set-the-variables-on-catalog-item-form-from-ui-action/m-p/2667994#M35029</guid>
      <dc:creator>Ankur Bawiskar</dc:creator>
      <dc:date>2023-09-11T15:25:17Z</dc:date>
    </item>
    <item>
      <title>Re: How we can set the variables on catalog item form from UI action.</title>
      <link>https://www.servicenow.com/community/service-management-forum/how-we-can-set-the-variables-on-catalog-item-form-from-ui-action/m-p/2668061#M35031</link>
      <description>&lt;P&gt;Hello&amp;nbsp;&lt;a href="https://www.servicenow.com/community/user/viewprofilepage/user-id/209175"&gt;@Peter Wood&lt;/a&gt;&amp;nbsp;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Can you try below code..!!&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Step 1 : Create UI action on Catalog Task Table (You can set visibility depending upon your requirement)&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="VishalBirajdar7_1-1694448343756.png" style="width: 659px;"&gt;&lt;img src="https://www.servicenow.com/community/image/serverpage/image-id/287715iD2BCB8D3F09CC7E7/image-dimensions/659x298?v=v2" width="659" height="298" role="button" title="VishalBirajdar7_1-1694448343756.png" alt="VishalBirajdar7_1-1694448343756.png" /&gt;&lt;/span&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Script :&lt;/P&gt;&lt;DIV&gt;&lt;PRE&gt;&lt;SPAN&gt;/* get teh values of variables */&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;function&lt;/SPAN&gt;&lt;SPAN&gt; redirectURL(){&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;//get the Values of variable from sc_task variables&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;var&lt;/SPAN&gt;&lt;SPAN&gt; var1 = g_form.getValue(&lt;/SPAN&gt;&lt;SPAN&gt;'variables.my_variable_1'&lt;/SPAN&gt;&lt;SPAN&gt;);&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;var&lt;/SPAN&gt;&lt;SPAN&gt; var2 = g_form.getValue(&lt;/SPAN&gt;&lt;SPAN&gt;'variables.my_variable_2'&lt;/SPAN&gt;&lt;SPAN&gt;);&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;/* Create custom URL */&lt;/SPAN&gt;&lt;BR /&gt;//sys_id of catalog item where we want to redirect&lt;BR /&gt;&lt;SPAN&gt;var&lt;/SPAN&gt;&lt;SPAN&gt; url = &lt;/SPAN&gt;&lt;SPAN&gt;"https://dev1127373.service-now.com/sp?id=sc_cat_item&amp;amp;&lt;FONT color="#FF0000"&gt;&lt;STRONG&gt;sys_id=fe0ebd1cc311b110ab85241ce0013175&lt;/STRONG&gt;&lt;/FONT&gt;"&lt;/SPAN&gt;&lt;SPAN&gt; + &lt;/SPAN&gt;&lt;SPAN&gt;'&amp;amp;sysparm_var1='&lt;/SPAN&gt;&lt;SPAN&gt; + var1 + &lt;/SPAN&gt;&lt;SPAN&gt;'&amp;amp;sysparm_var2='&lt;/SPAN&gt;&lt;SPAN&gt; + var2;&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;g_navigation.open(url, &lt;/SPAN&gt;&lt;SPAN&gt;'_blank'&lt;/SPAN&gt;&lt;SPAN&gt;);&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;}&lt;/SPAN&gt;&lt;/PRE&gt;&lt;/DIV&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Step 2 : Write onLoad client script on catalog item which we have redirected to.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;DIV&gt;&lt;PRE&gt;&lt;SPAN&gt;function&lt;/SPAN&gt;&lt;SPAN&gt; onLoad() {&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;&amp;nbsp; &amp;nbsp; &lt;/SPAN&gt;&lt;SPAN&gt;//get URL&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;&amp;nbsp; &amp;nbsp; &lt;/SPAN&gt;&lt;SPAN&gt;var&lt;/SPAN&gt;&lt;SPAN&gt; gUrl = top.location.href;&lt;BR /&gt;&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;&amp;nbsp; &amp;nbsp; &lt;/SPAN&gt;&lt;SPAN&gt;/* Split the URL and get Variables values */&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &lt;/SPAN&gt;&lt;SPAN&gt;var&lt;/SPAN&gt;&lt;SPAN&gt; variable1 = gUrl.split(&lt;/SPAN&gt;&lt;SPAN&gt;'&amp;amp;'&lt;/SPAN&gt;&lt;SPAN&gt;)[&lt;/SPAN&gt;&lt;SPAN&gt;2&lt;/SPAN&gt;&lt;SPAN&gt;].split(&lt;/SPAN&gt;&lt;SPAN&gt;'='&lt;/SPAN&gt;&lt;SPAN&gt;)[&lt;/SPAN&gt;&lt;SPAN&gt;1&lt;/SPAN&gt;&lt;SPAN&gt;];&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &lt;/SPAN&gt;&lt;SPAN&gt;var&lt;/SPAN&gt;&lt;SPAN&gt; variable2 = gUrl.split(&lt;/SPAN&gt;&lt;SPAN&gt;'&amp;amp;'&lt;/SPAN&gt;&lt;SPAN&gt;)[&lt;/SPAN&gt;&lt;SPAN&gt;3&lt;/SPAN&gt;&lt;SPAN&gt;].split(&lt;/SPAN&gt;&lt;SPAN&gt;'='&lt;/SPAN&gt;&lt;SPAN&gt;)[&lt;/SPAN&gt;&lt;SPAN&gt;1&lt;/SPAN&gt;&lt;SPAN&gt;];&lt;BR /&gt;    &lt;BR /&gt;/* Use your variable name */&lt;BR /&gt;&lt;BR /&gt;&amp;nbsp; &amp;nbsp; g_form.setValue('get_variable_1', variable1);&lt;BR /&gt;&amp;nbsp; &amp;nbsp; g_form.setValue('get_variable_2', variable2);&lt;BR /&gt;&lt;BR /&gt;}&lt;/SPAN&gt;&lt;/PRE&gt;&lt;/DIV&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Step 3 : Click on UI action created on catalog task&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="VishalBirajdar7_3-1694448914470.png" style="width: 503px;"&gt;&lt;img src="https://www.servicenow.com/community/image/serverpage/image-id/287717i69363D867B6679D7/image-dimensions/503x250?v=v2" width="503" height="250" role="button" title="VishalBirajdar7_3-1694448914470.png" alt="VishalBirajdar7_3-1694448914470.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;It will redirect you to Catalog form with variable value set on form&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="VishalBirajdar7_4-1694448943146.png" style="width: 526px;"&gt;&lt;img src="https://www.servicenow.com/community/image/serverpage/image-id/287719i01215DA5659FD46B/image-dimensions/526x251?v=v2" width="526" height="251" role="button" title="VishalBirajdar7_4-1694448943146.png" alt="VishalBirajdar7_4-1694448943146.png" /&gt;&lt;/span&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Mon, 11 Sep 2023 16:16:46 GMT</pubDate>
      <guid>https://www.servicenow.com/community/service-management-forum/how-we-can-set-the-variables-on-catalog-item-form-from-ui-action/m-p/2668061#M35031</guid>
      <dc:creator>Vishal Birajdar</dc:creator>
      <dc:date>2023-09-11T16:16:46Z</dc:date>
    </item>
  </channel>
</rss>

