<?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: Attachment mandatory not working in Serviceportal in ITSM forum</title>
    <link>https://www.servicenow.com/community/itsm-forum/attachment-mandatory-not-working-in-serviceportal/m-p/588304#M160083</link>
    <description>&lt;P&gt;&lt;SN-MENTION class="sn-mention" table="live_profile" sysid="914256e5dbd81fc09c9ffb651f9619a0"&gt;@salu&lt;/SN-MENTION&gt; &lt;/P&gt;
&lt;P&gt;Refer blog below&lt;/P&gt;
&lt;P&gt;&lt;A href="https://community.servicenow.com/community?id=community_blog&amp;amp;sys_id=00edd9751bb090d0ada243f6fe4bcba8" target="_blank"&gt; Verify Mandatory Attachments Count on Catalog Item &lt;/A&gt;&lt;/P&gt;
&lt;P&gt;Sharing the steps and script here&lt;/P&gt;
&lt;P&gt;&lt;STRONG&gt;Script:&lt;/STRONG&gt; onSubmit&lt;/P&gt;
&lt;P&gt;UI Type - ALL&lt;/P&gt;
&lt;P&gt;Applies to Catalog Item - True&lt;/P&gt;
&lt;P&gt;&lt;STRONG&gt;Note:&lt;/STRONG&gt; Ensure &lt;STRONG&gt;Isolate Script field is set to False&lt;/STRONG&gt; for this Catalog Client Script to ensure DOM manipulation works&lt;/P&gt;
&lt;PRE class="language-javascript"&gt;&lt;CODE&gt;function onSubmit() {
	//Type appropriate comment here, and begin script below

var countRequired = 1;
	if(window == null){
		// portal
		if(this.document.getElementsByClassName('get-attachment').length != countRequired) {
			alert('You must attach the completed form before submitting this request.');
			return false;
		}
	}
	else{
		// native view
         var length = $j("li.attachment_list_items").find("span").length;
		if(length != countRequired){
			alert('You must attach the completed form before submitting this request.');
			return false;
		}
	}
}&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P class="ng-scope"&gt;&lt;STRONG&gt;Isolate Script:&lt;/STRONG&gt; Set to False&lt;/P&gt;
&lt;P class="ng-scope"&gt;&lt;span class="lia-inline-image-display-wrapper"&gt;&lt;img src="https://www.servicenow.com/community/image/serverpage/image-id/36811i0AF136FE04C3828B/image-size/large?v=v2&amp;amp;px=999" title="image" alt="image" /&gt;&lt;/span&gt;&lt;/P&gt;
&lt;P class="ng-scope"&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Regards&lt;BR /&gt;Ankur&lt;/P&gt;</description>
    <pubDate>Thu, 03 Dec 2020 15:13:38 GMT</pubDate>
    <dc:creator>Ankur Bawiskar</dc:creator>
    <dc:date>2020-12-03T15:13:38Z</dc:date>
    <item>
      <title>Attachment mandatory not working in Serviceportal</title>
      <link>https://www.servicenow.com/community/itsm-forum/attachment-mandatory-not-working-in-serviceportal/m-p/588295#M160074</link>
      <description>&lt;P&gt;Hello All,&lt;/P&gt;
&lt;P&gt;I am trying to make attachment mandatory in catalog item and service portal. Below script working in catalog item but not working in serviceportal.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;We are using Add to cart button in service portal.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;function onSubmit() {&lt;BR /&gt; //Works in non-portal ui&lt;BR /&gt; try {&lt;BR /&gt; var attachments = document.getElementById('header_attachment_list_label');&lt;BR /&gt; if (attachments.style.visibility == 'hidden' || attachments.style.display == 'none') {&lt;BR /&gt; alert('You must attach the completed form before submitting this request.');&lt;BR /&gt; return false;&lt;BR /&gt; }&lt;BR /&gt; }&lt;BR /&gt; //For Service Portal&lt;BR /&gt; catch (e) {&lt;BR /&gt; var count = getSCAttachmentCount();&lt;BR /&gt; if (count &amp;lt;= 0) {&lt;BR /&gt; alert('You must attach the completed form before submitting this request.');&lt;BR /&gt; return false;&lt;BR /&gt; }&lt;BR /&gt; }&lt;BR /&gt;}&lt;/P&gt;
&lt;P&gt;Can some please help??&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Thanks&lt;/P&gt;
&lt;P&gt;Saranya&lt;/P&gt;</description>
      <pubDate>Thu, 03 Dec 2020 13:46:43 GMT</pubDate>
      <guid>https://www.servicenow.com/community/itsm-forum/attachment-mandatory-not-working-in-serviceportal/m-p/588295#M160074</guid>
      <dc:creator>salu</dc:creator>
      <dc:date>2020-12-03T13:46:43Z</dc:date>
    </item>
    <item>
      <title>Re: Attachment mandatory not working in Serviceportal</title>
      <link>https://www.servicenow.com/community/itsm-forum/attachment-mandatory-not-working-in-serviceportal/m-p/588296#M160075</link>
      <description>&lt;P&gt;are you getting any error in browser console ? please check also validate the ui script&amp;nbsp; "GlobalCatalogItemFunctions" for reference please validate the below thread.&lt;/P&gt;
&lt;P&gt;Assuming Client script UI Type set as ALL&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&lt;A href="https://community.servicenow.com/community?id=community_question&amp;amp;sys_id=de340b29dbd8dbc01dcaf3231f9619a3"&gt;https://community.servicenow.com/community?id=community_question&amp;amp;sys_id=de340b29dbd8dbc01dcaf3231f9619a3&lt;/A&gt;&lt;/P&gt;</description>
      <pubDate>Thu, 03 Dec 2020 13:51:37 GMT</pubDate>
      <guid>https://www.servicenow.com/community/itsm-forum/attachment-mandatory-not-working-in-serviceportal/m-p/588296#M160075</guid>
      <dc:creator>hvrdhn88</dc:creator>
      <dc:date>2020-12-03T13:51:37Z</dc:date>
    </item>
    <item>
      <title>Re: Attachment mandatory not working in Serviceportal</title>
      <link>https://www.servicenow.com/community/itsm-forum/attachment-mandatory-not-working-in-serviceportal/m-p/588297#M160076</link>
      <description>&lt;P&gt;OOTB, you can set "Mandatory Attachment" checkbox as true on catalog item to make your attachment mandatory. no script required.&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Thu, 03 Dec 2020 13:57:50 GMT</pubDate>
      <guid>https://www.servicenow.com/community/itsm-forum/attachment-mandatory-not-working-in-serviceportal/m-p/588297#M160076</guid>
      <dc:creator>hvrdhn88</dc:creator>
      <dc:date>2020-12-03T13:57:50Z</dc:date>
    </item>
    <item>
      <title>Re: Attachment mandatory not working in Serviceportal</title>
      <link>https://www.servicenow.com/community/itsm-forum/attachment-mandatory-not-working-in-serviceportal/m-p/588298#M160077</link>
      <description>&lt;P&gt;I want it mandatory is when user requesting a access request.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;I am getting this error.&lt;/P&gt;
&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper"&gt;&lt;img src="https://www.servicenow.com/community/image/serverpage/image-id/36808i18D1FE6C0A80E0D5/image-size/large?v=v2&amp;amp;px=999" 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;
&lt;P&gt;What need to update here?&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Thu, 03 Dec 2020 14:14:59 GMT</pubDate>
      <guid>https://www.servicenow.com/community/itsm-forum/attachment-mandatory-not-working-in-serviceportal/m-p/588298#M160077</guid>
      <dc:creator>salu</dc:creator>
      <dc:date>2020-12-03T14:14:59Z</dc:date>
    </item>
    <item>
      <title>Re: Attachment mandatory not working in Serviceportal</title>
      <link>https://www.servicenow.com/community/itsm-forum/attachment-mandatory-not-working-in-serviceportal/m-p/588299#M160078</link>
      <description>&lt;P&gt;was it working before ? right click &amp;gt;&amp;gt; Inspect element and check console log, what is the exact error showing there.&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;did you check the below thread and followed the steps while developing this solution ? please confirm&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;https://community.servicenow.com/community?id=community_question&amp;amp;sys_id=de340b29dbd8dbc01dcaf3231f9619a3&lt;/P&gt;</description>
      <pubDate>Thu, 03 Dec 2020 14:17:50 GMT</pubDate>
      <guid>https://www.servicenow.com/community/itsm-forum/attachment-mandatory-not-working-in-serviceportal/m-p/588299#M160078</guid>
      <dc:creator>hvrdhn88</dc:creator>
      <dc:date>2020-12-03T14:17:50Z</dc:date>
    </item>
    <item>
      <title>Re: Attachment mandatory not working in Serviceportal</title>
      <link>https://www.servicenow.com/community/itsm-forum/attachment-mandatory-not-working-in-serviceportal/m-p/588300#M160079</link>
      <description>&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;I would suggest to not use any script for portal .&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Updated client script and set UI Type as "Desktop"&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;PRE class="language-markup"&gt;&lt;CODE&gt;function onSubmit() {
//Works in non-portal ui

var attachments = document.getElementById('header_attachment_list_label');
if (attachments.style.visibility == 'hidden' || attachments.style.display == 'none') {
alert('You must attach the completed form before submitting this request.');
return false;
}


}&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;For Portal , open your catalog form and set "Mandatory Attachment" as true .&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper"&gt;&lt;img src="https://www.servicenow.com/community/image/serverpage/image-id/36812i0BABBEBFAA791EE2/image-size/large?v=v2&amp;amp;px=999" 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;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Thu, 03 Dec 2020 14:37:16 GMT</pubDate>
      <guid>https://www.servicenow.com/community/itsm-forum/attachment-mandatory-not-working-in-serviceportal/m-p/588300#M160079</guid>
      <dc:creator>hvrdhn88</dc:creator>
      <dc:date>2020-12-03T14:37:16Z</dc:date>
    </item>
    <item>
      <title>Re: Attachment mandatory not working in Serviceportal</title>
      <link>https://www.servicenow.com/community/itsm-forum/attachment-mandatory-not-working-in-serviceportal/m-p/588301#M160080</link>
      <description>&lt;P&gt;I don't want the whole catalog item for attachment mandatory. When ever user need access request,then add manager approval like.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;I need a confirm message if the user "Is this request a Access request?" If yes attachment is mandatory if no then able to submit the form&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Thu, 03 Dec 2020 15:00:23 GMT</pubDate>
      <guid>https://www.servicenow.com/community/itsm-forum/attachment-mandatory-not-working-in-serviceportal/m-p/588301#M160080</guid>
      <dc:creator>salu</dc:creator>
      <dc:date>2020-12-03T15:00:23Z</dc:date>
    </item>
    <item>
      <title>Re: Attachment mandatory not working in Serviceportal</title>
      <link>https://www.servicenow.com/community/itsm-forum/attachment-mandatory-not-working-in-serviceportal/m-p/588302#M160081</link>
      <description>&lt;P&gt;Got it. Did you follow the same step which has mentioned in below thread. Please confirm,&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Browser console error indicating you missed something in script, either UI Scripts or some method . Please check the below thread and confirm .&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&lt;A href="https://community.servicenow.com/community?id=community_question&amp;amp;sys_id=de340b29dbd8dbc01dcaf3231f9619a3"&gt;https://community.servicenow.com/community?id=community_question&amp;amp;sys_id=de340b29dbd8dbc01dcaf3231f9619a3&lt;/A&gt;&lt;/P&gt;</description>
      <pubDate>Thu, 03 Dec 2020 15:04:11 GMT</pubDate>
      <guid>https://www.servicenow.com/community/itsm-forum/attachment-mandatory-not-working-in-serviceportal/m-p/588302#M160081</guid>
      <dc:creator>hvrdhn88</dc:creator>
      <dc:date>2020-12-03T15:04:11Z</dc:date>
    </item>
    <item>
      <title>Re: Attachment mandatory not working in Serviceportal</title>
      <link>https://www.servicenow.com/community/itsm-forum/attachment-mandatory-not-working-in-serviceportal/m-p/588303#M160082</link>
      <description>&lt;P&gt;You are right.This is the error.&lt;/P&gt;
&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper"&gt;&lt;img src="https://www.servicenow.com/community/image/serverpage/image-id/36809iD80B847D4BF9FF67/image-size/large?v=v2&amp;amp;px=999" title="find_real_file.png" alt="find_real_file.png" /&gt;&lt;/span&gt;&lt;/P&gt;
&lt;P&gt;I am not able to find any script include with this name&lt;/P&gt;</description>
      <pubDate>Thu, 03 Dec 2020 15:12:46 GMT</pubDate>
      <guid>https://www.servicenow.com/community/itsm-forum/attachment-mandatory-not-working-in-serviceportal/m-p/588303#M160082</guid>
      <dc:creator>salu</dc:creator>
      <dc:date>2020-12-03T15:12:46Z</dc:date>
    </item>
    <item>
      <title>Re: Attachment mandatory not working in Serviceportal</title>
      <link>https://www.servicenow.com/community/itsm-forum/attachment-mandatory-not-working-in-serviceportal/m-p/588304#M160083</link>
      <description>&lt;P&gt;&lt;SN-MENTION class="sn-mention" table="live_profile" sysid="914256e5dbd81fc09c9ffb651f9619a0"&gt;@salu&lt;/SN-MENTION&gt; &lt;/P&gt;
&lt;P&gt;Refer blog below&lt;/P&gt;
&lt;P&gt;&lt;A href="https://community.servicenow.com/community?id=community_blog&amp;amp;sys_id=00edd9751bb090d0ada243f6fe4bcba8" target="_blank"&gt; Verify Mandatory Attachments Count on Catalog Item &lt;/A&gt;&lt;/P&gt;
&lt;P&gt;Sharing the steps and script here&lt;/P&gt;
&lt;P&gt;&lt;STRONG&gt;Script:&lt;/STRONG&gt; onSubmit&lt;/P&gt;
&lt;P&gt;UI Type - ALL&lt;/P&gt;
&lt;P&gt;Applies to Catalog Item - True&lt;/P&gt;
&lt;P&gt;&lt;STRONG&gt;Note:&lt;/STRONG&gt; Ensure &lt;STRONG&gt;Isolate Script field is set to False&lt;/STRONG&gt; for this Catalog Client Script to ensure DOM manipulation works&lt;/P&gt;
&lt;PRE class="language-javascript"&gt;&lt;CODE&gt;function onSubmit() {
	//Type appropriate comment here, and begin script below

var countRequired = 1;
	if(window == null){
		// portal
		if(this.document.getElementsByClassName('get-attachment').length != countRequired) {
			alert('You must attach the completed form before submitting this request.');
			return false;
		}
	}
	else{
		// native view
         var length = $j("li.attachment_list_items").find("span").length;
		if(length != countRequired){
			alert('You must attach the completed form before submitting this request.');
			return false;
		}
	}
}&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P class="ng-scope"&gt;&lt;STRONG&gt;Isolate Script:&lt;/STRONG&gt; Set to False&lt;/P&gt;
&lt;P class="ng-scope"&gt;&lt;span class="lia-inline-image-display-wrapper"&gt;&lt;img src="https://www.servicenow.com/community/image/serverpage/image-id/36811i0AF136FE04C3828B/image-size/large?v=v2&amp;amp;px=999" title="image" alt="image" /&gt;&lt;/span&gt;&lt;/P&gt;
&lt;P class="ng-scope"&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Regards&lt;BR /&gt;Ankur&lt;/P&gt;</description>
      <pubDate>Thu, 03 Dec 2020 15:13:38 GMT</pubDate>
      <guid>https://www.servicenow.com/community/itsm-forum/attachment-mandatory-not-working-in-serviceportal/m-p/588304#M160083</guid>
      <dc:creator>Ankur Bawiskar</dc:creator>
      <dc:date>2020-12-03T15:13:38Z</dc:date>
    </item>
    <item>
      <title>Re: Attachment mandatory not working in Serviceportal</title>
      <link>https://www.servicenow.com/community/itsm-forum/attachment-mandatory-not-working-in-serviceportal/m-p/588305#M160084</link>
      <description>&lt;P&gt;This is UI Scripts method name.&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Thu, 03 Dec 2020 15:13:50 GMT</pubDate>
      <guid>https://www.servicenow.com/community/itsm-forum/attachment-mandatory-not-working-in-serviceportal/m-p/588305#M160084</guid>
      <dc:creator>hvrdhn88</dc:creator>
      <dc:date>2020-12-03T15:13:50Z</dc:date>
    </item>
    <item>
      <title>Re: Attachment mandatory not working in Serviceportal</title>
      <link>https://www.servicenow.com/community/itsm-forum/attachment-mandatory-not-working-in-serviceportal/m-p/588306#M160085</link>
      <description>&lt;P&gt;&lt;STRONG&gt;UI Script:&lt;/STRONG&gt;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&lt;STRONG&gt;API Name:&lt;/STRONG&gt;GlobalCatalogItemFunctions&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&lt;STRONG&gt;Script:&lt;/STRONG&gt;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;function &lt;STRONG&gt;getSCAttachmentCount&lt;/STRONG&gt;() {&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp; var length;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp; try {&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp; length = angular.element("#sc_cat_item").scope().attachments.length;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp; } catch(e) {&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp; length = -1;&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; return length;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&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;
&lt;P&gt;&lt;STRONG&gt;onSubmit Catalog Client Script:&lt;/STRONG&gt;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;function onSubmit() {&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp; var contract = g_form.getValue('signed_pricing_contract');&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp; if(contract == 'Yes'){&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp; try { //Works in non-portal ui&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp; var attachments = document.getElementById('header_attachment_list_label');&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp; if (attachments.style.visibility == 'hidden' || attachments.style.display == 'none' ) {&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp; alert('Please attach atleast one attachment to proceed');&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp; return false;&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;
&lt;P&gt;&amp;nbsp; catch(e) { //For Service Portal&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp; var count = getSCAttachmentCount();&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp; if(count &amp;lt;= 0) {&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp; alert('Please attach atleast one attachment to proceed');&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp; return false;&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;
&lt;P&gt;&amp;nbsp; }&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;}&lt;/P&gt;</description>
      <pubDate>Thu, 03 Dec 2020 15:15:10 GMT</pubDate>
      <guid>https://www.servicenow.com/community/itsm-forum/attachment-mandatory-not-working-in-serviceportal/m-p/588306#M160085</guid>
      <dc:creator>hvrdhn88</dc:creator>
      <dc:date>2020-12-03T15:15:10Z</dc:date>
    </item>
    <item>
      <title>Re: Attachment mandatory not working in Serviceportal</title>
      <link>https://www.servicenow.com/community/itsm-forum/attachment-mandatory-not-working-in-serviceportal/m-p/588307#M160086</link>
      <description>&lt;P&gt;here if you see there is method&amp;nbsp;&lt;STRONG&gt;getSCAttachmentCount()&amp;nbsp;&lt;/STRONG&gt; which has defined in UI Script, so make sure you have created ui script and then called in your catalog client script.&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Thu, 03 Dec 2020 15:17:14 GMT</pubDate>
      <guid>https://www.servicenow.com/community/itsm-forum/attachment-mandatory-not-working-in-serviceportal/m-p/588307#M160086</guid>
      <dc:creator>hvrdhn88</dc:creator>
      <dc:date>2020-12-03T15:17:14Z</dc:date>
    </item>
    <item>
      <title>Re: Attachment mandatory not working in Serviceportal</title>
      <link>https://www.servicenow.com/community/itsm-forum/attachment-mandatory-not-working-in-serviceportal/m-p/588308#M160087</link>
      <description>&lt;P&gt;UI script is there&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper"&gt;&lt;img src="https://www.servicenow.com/community/image/serverpage/image-id/36807i38F8B805E3584CE1/image-size/large?v=v2&amp;amp;px=999" title="find_real_file.png" alt="find_real_file.png" /&gt;&lt;/span&gt;&lt;/P&gt;</description>
      <pubDate>Thu, 03 Dec 2020 15:24:00 GMT</pubDate>
      <guid>https://www.servicenow.com/community/itsm-forum/attachment-mandatory-not-working-in-serviceportal/m-p/588308#M160087</guid>
      <dc:creator>salu</dc:creator>
      <dc:date>2020-12-03T15:24:00Z</dc:date>
    </item>
    <item>
      <title>Re: Attachment mandatory not working in Serviceportal</title>
      <link>https://www.servicenow.com/community/itsm-forum/attachment-mandatory-not-working-in-serviceportal/m-p/588309#M160088</link>
      <description>&lt;P&gt;is it still giving error in console ?&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Thu, 03 Dec 2020 15:26:57 GMT</pubDate>
      <guid>https://www.servicenow.com/community/itsm-forum/attachment-mandatory-not-working-in-serviceportal/m-p/588309#M160088</guid>
      <dc:creator>hvrdhn88</dc:creator>
      <dc:date>2020-12-03T15:26:57Z</dc:date>
    </item>
    <item>
      <title>Re: Attachment mandatory not working in Serviceportal</title>
      <link>https://www.servicenow.com/community/itsm-forum/attachment-mandatory-not-working-in-serviceportal/m-p/588310#M160089</link>
      <description>&lt;P&gt;It worked.Thank you very much&lt;/P&gt;</description>
      <pubDate>Thu, 03 Dec 2020 15:27:12 GMT</pubDate>
      <guid>https://www.servicenow.com/community/itsm-forum/attachment-mandatory-not-working-in-serviceportal/m-p/588310#M160089</guid>
      <dc:creator>salu</dc:creator>
      <dc:date>2020-12-03T15:27:12Z</dc:date>
    </item>
    <item>
      <title>Re: Attachment mandatory not working in Serviceportal</title>
      <link>https://www.servicenow.com/community/itsm-forum/attachment-mandatory-not-working-in-serviceportal/m-p/588311#M160090</link>
      <description>&lt;P&gt;Yes it was giving the same error&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;I have change the onsubmit script to this and it got worked..&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Thank you very much for the help!!!&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;PRE class="language-javascript"&gt;&lt;CODE&gt;function onSubmit() {
	//Type appropriate comment here, and begin script below

var countRequired = 1;
	if(window == null){
		// portal
		if(this.document.getElementsByClassName('get-attachment').length != countRequired) {
			alert('You must attach the completed form before submitting this request.');
			return false;
		}
	}
	else{
		// native view
         var length = $j("li.attachment_list_items").find("span").length;
		if(length != countRequired){
			alert('You must attach the completed form before submitting this request.');
			return false;
		}
	}
}&lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Thu, 03 Dec 2020 15:29:44 GMT</pubDate>
      <guid>https://www.servicenow.com/community/itsm-forum/attachment-mandatory-not-working-in-serviceportal/m-p/588311#M160090</guid>
      <dc:creator>salu</dc:creator>
      <dc:date>2020-12-03T15:29:44Z</dc:date>
    </item>
    <item>
      <title>Re: Attachment mandatory not working in Serviceportal</title>
      <link>https://www.servicenow.com/community/itsm-forum/attachment-mandatory-not-working-in-serviceportal/m-p/588312#M160091</link>
      <description>&lt;P&gt;You missed one thing on your old script. you did not include your ui script inside the service portal theme .&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;eg:&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;OL data-rte-list="default"&gt;
&lt;LI&gt;
&lt;P class=""&gt;In the Left Navigator Bar, go to Service Portal &amp;gt; Portals&lt;/P&gt;
&lt;/LI&gt;
&lt;LI&gt;
&lt;P class=""&gt;Click the Portal you want to adjust. It maybe be the one with URL suffix of "sp".&lt;/P&gt;
&lt;/LI&gt;
&lt;LI&gt;
&lt;P class=""&gt;Click the "info" button for the Theme. The standard theme is "Stock" or “La Jolla”&lt;/P&gt;
&lt;/LI&gt;
&lt;LI&gt;
&lt;P class=""&gt;Scroll to the bottom to the JS Include Related List&lt;/P&gt;
&lt;/LI&gt;
&lt;LI&gt;
&lt;P class=""&gt;Add your JS Include there&lt;/P&gt;
&lt;/LI&gt;
&lt;/OL&gt;
&lt;BLOCKQUOTE id="yui_3_17_2_1_1607009950002_654"&gt;
&lt;P id="yui_3_17_2_1_1607009950002_653" class=""&gt;Create New JS Theme&lt;BR /&gt;Display Name: GlobalCatalogItemFunctions&lt;BR /&gt;UI Script: GlobalCatalogItemFunctions&lt;/P&gt;
&lt;P class=""&gt;&amp;nbsp;&lt;/P&gt;
&lt;P class=""&gt;This is the reason your are getting error in console. at least&amp;nbsp; give a try to so you will be sure what was you missing.&amp;nbsp;&lt;/P&gt;
&lt;/BLOCKQUOTE&gt;</description>
      <pubDate>Thu, 03 Dec 2020 15:44:46 GMT</pubDate>
      <guid>https://www.servicenow.com/community/itsm-forum/attachment-mandatory-not-working-in-serviceportal/m-p/588312#M160091</guid>
      <dc:creator>hvrdhn88</dc:creator>
      <dc:date>2020-12-03T15:44:46Z</dc:date>
    </item>
    <item>
      <title>Re: Attachment mandatory not working in Serviceportal</title>
      <link>https://www.servicenow.com/community/itsm-forum/attachment-mandatory-not-working-in-serviceportal/m-p/588313#M160092</link>
      <description>&lt;P&gt;&lt;SN-MENTION class="sn-mention" table="live_profile" sysid="914256e5dbd81fc09c9ffb651f9619a0"&gt;@salu&lt;/SN-MENTION&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Glad that my script/approach helped/worked.&lt;/P&gt;
&lt;P&gt;Please mark my response as correct and helpful to close the thread so that others can be benefited in future.&lt;/P&gt;
&lt;P&gt;Regards&lt;BR /&gt;Ankur&lt;/P&gt;</description>
      <pubDate>Thu, 03 Dec 2020 15:46:29 GMT</pubDate>
      <guid>https://www.servicenow.com/community/itsm-forum/attachment-mandatory-not-working-in-serviceportal/m-p/588313#M160092</guid>
      <dc:creator>Ankur Bawiskar</dc:creator>
      <dc:date>2020-12-03T15:46:29Z</dc:date>
    </item>
    <item>
      <title>Re: Attachment mandatory not working in Serviceportal</title>
      <link>https://www.servicenow.com/community/itsm-forum/attachment-mandatory-not-working-in-serviceportal/m-p/588314#M160093</link>
      <description>&lt;P&gt;you should at least try with my last response which you were missing. I tested that in my personal instance and working after that. include your ui script in portal theme then that method would be reachable on portal.&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Thu, 03 Dec 2020 15:49:33 GMT</pubDate>
      <guid>https://www.servicenow.com/community/itsm-forum/attachment-mandatory-not-working-in-serviceportal/m-p/588314#M160093</guid>
      <dc:creator>hvrdhn88</dc:creator>
      <dc:date>2020-12-03T15:49:33Z</dc:date>
    </item>
  </channel>
</rss>

