<?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 Receiving error &amp;quot;ReferenceError: 'func' is not defined:&amp;quot; after adding Catalog Client Script in Developer forum</title>
    <link>https://www.servicenow.com/community/developer-forum/receiving-error-quot-referenceerror-func-is-not-defined-quot/m-p/1473987#M130913</link>
    <description>&lt;P&gt;&lt;SPAN style="font-family: arial, helvetica, sans-serif; font-size: 12pt;"&gt;We have a computer replacement request with the requirement that the fulfiller must check a box on a specific task (multiple choice field hidden on the REQ named “need_computer”).&amp;nbsp; The task goes to a dispatch group who will reassign the task to a technician so it can’t be required unless the task is attempting to be closed.&amp;nbsp;&lt;/SPAN&gt;&lt;/P&gt;
&lt;P&gt;&lt;SPAN style="font-family: arial, helvetica, sans-serif; font-size: 12pt;"&gt;I used the answer&amp;nbsp;here:&lt;/SPAN&gt;&lt;/P&gt;
&lt;P&gt;&lt;A href="https://community.servicenow.com/community?id=community_question&amp;amp;sys_id=9622036ddb98dbc01dcaf3231f96195f" rel="nofollow"&gt;https://community.servicenow.com/community?id=community_question&amp;amp;sys_id=9622036ddb98dbc01dcaf3231f96195f&lt;/A&gt;&lt;/P&gt;
&lt;P&gt;&lt;SPAN style="font-family: arial, helvetica, sans-serif; font-size: 12pt;"&gt;and added this Catalog Client Script:&lt;/SPAN&gt;&lt;/P&gt;
&lt;TABLE&gt;&lt;TBODY&gt;&lt;TR&gt;&lt;TD&gt;&lt;SPAN style="font-family: 'courier new', courier; font-size: 10pt;"&gt;function onSubmit() {&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN style="font-family: 'courier new', courier; font-size: 10pt;"&gt;//Type appropriate comment here, and begin script below&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN style="font-family: 'courier new', courier; font-size: 10pt;"&gt;var ritm= g_form.getReferenec("request_item");&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN style="font-family: 'courier new', courier; font-size: 10pt;"&gt;if((g_form.getValue('state')==3) &amp;amp;&amp;amp; (ritm.cat_item=='3d131f3fdbec73004c1cd92b5e961928')){&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN style="font-family: 'courier new', courier; font-size: 10pt;"&gt;if(g_form.getValue('variables.need_computer')==''){&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN style="font-family: 'courier new', courier; font-size: 10pt;"&gt;g_form.setMandatory('variables.need_computer',true);&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN style="font-family: 'courier new', courier; font-size: 10pt;"&gt;return false;&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN style="font-family: 'courier new', courier; font-size: 10pt;"&gt;}&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN style="font-family: 'courier new', courier; font-size: 10pt;"&gt;}&amp;nbsp;&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN style="font-family: 'courier new', courier; font-size: 10pt;"&gt;}&lt;/SPAN&gt;&lt;/TD&gt;&lt;/TR&gt;&lt;/TBODY&gt;&lt;/TABLE&gt;
&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper" image-alt="find_real_file.png"&gt;&lt;img src="https://www.servicenow.com/community/image/serverpage/image-id/161708i668ABB029A09BFBB/image-size/large?v=v2&amp;amp;px=999" role="button" title="find_real_file.png" alt="find_real_file.png" /&gt;&lt;/span&gt;&amp;nbsp;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&lt;SPAN style="font-family: arial, helvetica, sans-serif; font-size: 12pt;"&gt;However,&amp;nbsp;I get this error when I attempt to close the task regardless if I select an option in “need_computer” or not:&lt;/SPAN&gt;&lt;/P&gt;
&lt;TABLE&gt;&lt;TBODY&gt;&lt;TR&gt;&lt;TD&gt;&lt;SPAN style="font-family: 'courier new', courier; font-size: 10pt;"&gt;Error MessageonSubmit script error: ReferenceError: 'func' is not defined:&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN style="font-family: 'courier new', courier; font-size: 10pt;"&gt;function&amp;nbsp;()&amp;nbsp;{&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN style="font-family: 'courier new', courier; font-size: 10pt;"&gt;saveAllSelected([&amp;nbsp;gel(id)&amp;nbsp;],&amp;nbsp;[&amp;nbsp;gel(ref)&amp;nbsp;],&amp;nbsp;',',&amp;nbsp;'\\',&amp;nbsp;'--None--');&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN style="font-family: 'courier new', courier; font-size: 10pt;"&gt;}&lt;/SPAN&gt;&lt;/TD&gt;&lt;/TR&gt;&lt;/TBODY&gt;&lt;/TABLE&gt;
&lt;P&gt;&lt;SPAN style="font-family: 'courier new', courier; font-size: 10pt;"&gt;&lt;span class="lia-inline-image-display-wrapper" image-alt="find_real_file.png"&gt;&lt;img src="https://www.servicenow.com/community/image/serverpage/image-id/161706iD3CB64A816690305/image-size/large?v=v2&amp;amp;px=999" role="button" title="find_real_file.png" alt="find_real_file.png" /&gt;&lt;/span&gt;&lt;/SPAN&gt;&lt;/P&gt;
&lt;P&gt;&lt;SPAN style="font-family: arial, helvetica, sans-serif; font-size: 12pt;"&gt;Appreciate any help.&lt;/SPAN&gt;&lt;/P&gt;</description>
    <pubDate>Mon, 20 May 2019 20:52:01 GMT</pubDate>
    <dc:creator>Brian155</dc:creator>
    <dc:date>2019-05-20T20:52:01Z</dc:date>
    <item>
      <title>Receiving error "ReferenceError: 'func' is not defined:" after adding Catalog Client Script</title>
      <link>https://www.servicenow.com/community/developer-forum/receiving-error-quot-referenceerror-func-is-not-defined-quot/m-p/1473987#M130913</link>
      <description>&lt;P&gt;&lt;SPAN style="font-family: arial, helvetica, sans-serif; font-size: 12pt;"&gt;We have a computer replacement request with the requirement that the fulfiller must check a box on a specific task (multiple choice field hidden on the REQ named “need_computer”).&amp;nbsp; The task goes to a dispatch group who will reassign the task to a technician so it can’t be required unless the task is attempting to be closed.&amp;nbsp;&lt;/SPAN&gt;&lt;/P&gt;
&lt;P&gt;&lt;SPAN style="font-family: arial, helvetica, sans-serif; font-size: 12pt;"&gt;I used the answer&amp;nbsp;here:&lt;/SPAN&gt;&lt;/P&gt;
&lt;P&gt;&lt;A href="https://community.servicenow.com/community?id=community_question&amp;amp;sys_id=9622036ddb98dbc01dcaf3231f96195f" rel="nofollow"&gt;https://community.servicenow.com/community?id=community_question&amp;amp;sys_id=9622036ddb98dbc01dcaf3231f96195f&lt;/A&gt;&lt;/P&gt;
&lt;P&gt;&lt;SPAN style="font-family: arial, helvetica, sans-serif; font-size: 12pt;"&gt;and added this Catalog Client Script:&lt;/SPAN&gt;&lt;/P&gt;
&lt;TABLE&gt;&lt;TBODY&gt;&lt;TR&gt;&lt;TD&gt;&lt;SPAN style="font-family: 'courier new', courier; font-size: 10pt;"&gt;function onSubmit() {&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN style="font-family: 'courier new', courier; font-size: 10pt;"&gt;//Type appropriate comment here, and begin script below&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN style="font-family: 'courier new', courier; font-size: 10pt;"&gt;var ritm= g_form.getReferenec("request_item");&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN style="font-family: 'courier new', courier; font-size: 10pt;"&gt;if((g_form.getValue('state')==3) &amp;amp;&amp;amp; (ritm.cat_item=='3d131f3fdbec73004c1cd92b5e961928')){&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN style="font-family: 'courier new', courier; font-size: 10pt;"&gt;if(g_form.getValue('variables.need_computer')==''){&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN style="font-family: 'courier new', courier; font-size: 10pt;"&gt;g_form.setMandatory('variables.need_computer',true);&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN style="font-family: 'courier new', courier; font-size: 10pt;"&gt;return false;&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN style="font-family: 'courier new', courier; font-size: 10pt;"&gt;}&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN style="font-family: 'courier new', courier; font-size: 10pt;"&gt;}&amp;nbsp;&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN style="font-family: 'courier new', courier; font-size: 10pt;"&gt;}&lt;/SPAN&gt;&lt;/TD&gt;&lt;/TR&gt;&lt;/TBODY&gt;&lt;/TABLE&gt;
&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper" image-alt="find_real_file.png"&gt;&lt;img src="https://www.servicenow.com/community/image/serverpage/image-id/161708i668ABB029A09BFBB/image-size/large?v=v2&amp;amp;px=999" role="button" title="find_real_file.png" alt="find_real_file.png" /&gt;&lt;/span&gt;&amp;nbsp;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&lt;SPAN style="font-family: arial, helvetica, sans-serif; font-size: 12pt;"&gt;However,&amp;nbsp;I get this error when I attempt to close the task regardless if I select an option in “need_computer” or not:&lt;/SPAN&gt;&lt;/P&gt;
&lt;TABLE&gt;&lt;TBODY&gt;&lt;TR&gt;&lt;TD&gt;&lt;SPAN style="font-family: 'courier new', courier; font-size: 10pt;"&gt;Error MessageonSubmit script error: ReferenceError: 'func' is not defined:&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN style="font-family: 'courier new', courier; font-size: 10pt;"&gt;function&amp;nbsp;()&amp;nbsp;{&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN style="font-family: 'courier new', courier; font-size: 10pt;"&gt;saveAllSelected([&amp;nbsp;gel(id)&amp;nbsp;],&amp;nbsp;[&amp;nbsp;gel(ref)&amp;nbsp;],&amp;nbsp;',',&amp;nbsp;'\\',&amp;nbsp;'--None--');&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN style="font-family: 'courier new', courier; font-size: 10pt;"&gt;}&lt;/SPAN&gt;&lt;/TD&gt;&lt;/TR&gt;&lt;/TBODY&gt;&lt;/TABLE&gt;
&lt;P&gt;&lt;SPAN style="font-family: 'courier new', courier; font-size: 10pt;"&gt;&lt;span class="lia-inline-image-display-wrapper" image-alt="find_real_file.png"&gt;&lt;img src="https://www.servicenow.com/community/image/serverpage/image-id/161706iD3CB64A816690305/image-size/large?v=v2&amp;amp;px=999" role="button" title="find_real_file.png" alt="find_real_file.png" /&gt;&lt;/span&gt;&lt;/SPAN&gt;&lt;/P&gt;
&lt;P&gt;&lt;SPAN style="font-family: arial, helvetica, sans-serif; font-size: 12pt;"&gt;Appreciate any help.&lt;/SPAN&gt;&lt;/P&gt;</description>
      <pubDate>Mon, 20 May 2019 20:52:01 GMT</pubDate>
      <guid>https://www.servicenow.com/community/developer-forum/receiving-error-quot-referenceerror-func-is-not-defined-quot/m-p/1473987#M130913</guid>
      <dc:creator>Brian155</dc:creator>
      <dc:date>2019-05-20T20:52:01Z</dc:date>
    </item>
    <item>
      <title>Re: Receiving error "ReferenceError: 'func' is not defined:" after adding Catalog Client Script</title>
      <link>https://www.servicenow.com/community/developer-forum/receiving-error-quot-referenceerror-func-is-not-defined-quot/m-p/1473988#M130914</link>
      <description>&lt;P&gt;Hi,&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Why can't use a Catalog UI policy for this requirement .&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&lt;A href="https://docs.servicenow.com/bundle/london-it-service-management/page/product/service-catalog-management/task/t_CreatUIPolicyForSvcCalgIt.html" rel="nofollow"&gt;https://docs.servicenow.com/bundle/london-it-service-management/page/product/service-catalog-management/task/t_CreatUIPolicyForSvcCalgIt.html&lt;/A&gt;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Thanks,&lt;/P&gt;
&lt;P&gt;pavan&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Note : Please mark my answer correct / helpful so that servicenow will not wip out this question from the community .&lt;/P&gt;</description>
      <pubDate>Mon, 20 May 2019 20:57:46 GMT</pubDate>
      <guid>https://www.servicenow.com/community/developer-forum/receiving-error-quot-referenceerror-func-is-not-defined-quot/m-p/1473988#M130914</guid>
      <dc:creator>pavan9885</dc:creator>
      <dc:date>2019-05-20T20:57:46Z</dc:date>
    </item>
    <item>
      <title>Re: Receiving error "ReferenceError: 'func' is not defined:" after adding Catalog Client Script</title>
      <link>https://www.servicenow.com/community/developer-forum/receiving-error-quot-referenceerror-func-is-not-defined-quot/m-p/1473989#M130915</link>
      <description>&lt;P&gt;That's what I started with.&amp;nbsp; The problem is how do I have it only trigger on Closed Complete when I can't locate the state variable with the filters?&lt;/P&gt;</description>
      <pubDate>Mon, 20 May 2019 21:30:37 GMT</pubDate>
      <guid>https://www.servicenow.com/community/developer-forum/receiving-error-quot-referenceerror-func-is-not-defined-quot/m-p/1473989#M130915</guid>
      <dc:creator>Brian155</dc:creator>
      <dc:date>2019-05-20T21:30:37Z</dc:date>
    </item>
    <item>
      <title>Re: Receiving error "ReferenceError: 'func' is not defined:" after adding Catalog Client Script</title>
      <link>https://www.servicenow.com/community/developer-forum/receiving-error-quot-referenceerror-func-is-not-defined-quot/m-p/1473990#M130916</link>
      <description>&lt;P&gt;HI Brain,&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;you can see the variable names in the filter in the catalog ui policy and also you can write some conditions like when assignment group changes make it mandatory .&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Please include the screen shots of the catalog ui policy ur trying to create.&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;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Tue, 21 May 2019 14:26:11 GMT</pubDate>
      <guid>https://www.servicenow.com/community/developer-forum/receiving-error-quot-referenceerror-func-is-not-defined-quot/m-p/1473990#M130916</guid>
      <dc:creator>pavan9885</dc:creator>
      <dc:date>2019-05-21T14:26:11Z</dc:date>
    </item>
    <item>
      <title>Re: Receiving error "ReferenceError: 'func' is not defined:" after adding Catalog Client Script</title>
      <link>https://www.servicenow.com/community/developer-forum/receiving-error-quot-referenceerror-func-is-not-defined-quot/m-p/1473991#M130917</link>
      <description>&lt;P&gt;Hi Pavan,&lt;/P&gt;
&lt;P&gt;The problem is the catalog task state field isn't available from the REQ Catalog Req Policy&lt;/P&gt;
&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper" image-alt="find_real_file.png"&gt;&lt;img src="https://www.servicenow.com/community/image/serverpage/image-id/161704iEA69D4BE14EE0B32/image-size/large?v=v2&amp;amp;px=999" role="button" title="find_real_file.png" alt="find_real_file.png" /&gt;&lt;/span&gt;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Tue, 21 May 2019 19:59:34 GMT</pubDate>
      <guid>https://www.servicenow.com/community/developer-forum/receiving-error-quot-referenceerror-func-is-not-defined-quot/m-p/1473991#M130917</guid>
      <dc:creator>Brian155</dc:creator>
      <dc:date>2019-05-21T19:59:34Z</dc:date>
    </item>
    <item>
      <title>Re: Receiving error "ReferenceError: 'func' is not defined:" after adding Catalog Client Script</title>
      <link>https://www.servicenow.com/community/developer-forum/receiving-error-quot-referenceerror-func-is-not-defined-quot/m-p/1473992#M130918</link>
      <description>&lt;P&gt;hit the wrong button.&amp;nbsp;&lt;/P&gt;
&lt;P&gt;I was able to get it working by moving the need_computer field to the sc_task table, then setting a system UI Policy to only show it on the one task, and another to make it mandatory on close.&amp;nbsp; &amp;nbsp;Then I added a workflow if script to route the ticket accordingly.&lt;/P&gt;
&lt;P&gt;The problem was the fields I needed to base this on were not available through the request catalog ui policy.&amp;nbsp;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Thank you for your assistance!&lt;/P&gt;</description>
      <pubDate>Tue, 21 May 2019 20:02:46 GMT</pubDate>
      <guid>https://www.servicenow.com/community/developer-forum/receiving-error-quot-referenceerror-func-is-not-defined-quot/m-p/1473992#M130918</guid>
      <dc:creator>Brian155</dc:creator>
      <dc:date>2019-05-21T20:02:46Z</dc:date>
    </item>
    <item>
      <title>Re: Receiving error "ReferenceError: 'func' is not defined:" after adding Catalog Client Script</title>
      <link>https://www.servicenow.com/community/developer-forum/receiving-error-quot-referenceerror-func-is-not-defined-quot/m-p/1473993#M130919</link>
      <description>&lt;P&gt;HI Brain&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;if my suggestion helps you please mark it as helpful &amp;amp; correct so this question will not be wipped out from the community .&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;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Tue, 21 May 2019 21:20:27 GMT</pubDate>
      <guid>https://www.servicenow.com/community/developer-forum/receiving-error-quot-referenceerror-func-is-not-defined-quot/m-p/1473993#M130919</guid>
      <dc:creator>pavan9885</dc:creator>
      <dc:date>2019-05-21T21:20:27Z</dc:date>
    </item>
  </channel>
</rss>

