<?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: Need to make attachment mandatory in a Catalog Item if a checkbox is checked in ITSM forum</title>
    <link>https://www.servicenow.com/community/itsm-forum/need-to-make-attachment-mandatory-in-a-catalog-item-if-a/m-p/507922#M79701</link>
    <description>&lt;P&gt;Hi,&lt;/P&gt;
&lt;P&gt;You cant use "Mandatory attachment" field or UI Policy. "Mandatory&amp;nbsp;attachment" field make the attachment mandatory for the catalog item. You can't apply using condition.&amp;nbsp;You have to use client script. Refer below thread:&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;A href="https://community.servicenow.com/community?id=community_question&amp;amp;sys_id=47dc4b0cdbff90509e691ea6689619b4"&gt;https://community.servicenow.com/community?id=community_question&amp;amp;sys_id=47dc4b0cdbff90509e691ea6689619b4&lt;/A&gt;&lt;/P&gt;</description>
    <pubDate>Tue, 02 Nov 2021 14:12:33 GMT</pubDate>
    <dc:creator>palanikumar</dc:creator>
    <dc:date>2021-11-02T14:12:33Z</dc:date>
    <item>
      <title>Need to make attachment mandatory in a Catalog Item if a checkbox is checked</title>
      <link>https://www.servicenow.com/community/itsm-forum/need-to-make-attachment-mandatory-in-a-catalog-item-if-a/m-p/507921#M79700</link>
      <description>&lt;P&gt;I have a small form in this Catalog item. When one of the checkboxes is ticked, I need the attachment to be mandatory. If it is not checked it must not be mandatory.&lt;/P&gt;
&lt;P&gt;I have read a ton of articles on how to do this, all different. Can I use a UI policy to change the OOTB 'Mandatory attachment' variable? That would seem easiest to me.&lt;/P&gt;
&lt;P&gt;Most articles seem to work around it with a UI script&lt;/P&gt;</description>
      <pubDate>Tue, 02 Nov 2021 13:55:53 GMT</pubDate>
      <guid>https://www.servicenow.com/community/itsm-forum/need-to-make-attachment-mandatory-in-a-catalog-item-if-a/m-p/507921#M79700</guid>
      <dc:creator>Bart Jan Bultma</dc:creator>
      <dc:date>2021-11-02T13:55:53Z</dc:date>
    </item>
    <item>
      <title>Re: Need to make attachment mandatory in a Catalog Item if a checkbox is checked</title>
      <link>https://www.servicenow.com/community/itsm-forum/need-to-make-attachment-mandatory-in-a-catalog-item-if-a/m-p/507922#M79701</link>
      <description>&lt;P&gt;Hi,&lt;/P&gt;
&lt;P&gt;You cant use "Mandatory attachment" field or UI Policy. "Mandatory&amp;nbsp;attachment" field make the attachment mandatory for the catalog item. You can't apply using condition.&amp;nbsp;You have to use client script. Refer below thread:&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;A href="https://community.servicenow.com/community?id=community_question&amp;amp;sys_id=47dc4b0cdbff90509e691ea6689619b4"&gt;https://community.servicenow.com/community?id=community_question&amp;amp;sys_id=47dc4b0cdbff90509e691ea6689619b4&lt;/A&gt;&lt;/P&gt;</description>
      <pubDate>Tue, 02 Nov 2021 14:12:33 GMT</pubDate>
      <guid>https://www.servicenow.com/community/itsm-forum/need-to-make-attachment-mandatory-in-a-catalog-item-if-a/m-p/507922#M79701</guid>
      <dc:creator>palanikumar</dc:creator>
      <dc:date>2021-11-02T14:12:33Z</dc:date>
    </item>
    <item>
      <title>Re: Need to make attachment mandatory in a Catalog Item if a checkbox is checked</title>
      <link>https://www.servicenow.com/community/itsm-forum/need-to-make-attachment-mandatory-in-a-catalog-item-if-a/m-p/507923#M79702</link>
      <description>&lt;P&gt;I'm going to try that one out, thanks for the clear answer about UI policy!&lt;/P&gt;</description>
      <pubDate>Tue, 02 Nov 2021 14:16:55 GMT</pubDate>
      <guid>https://www.servicenow.com/community/itsm-forum/need-to-make-attachment-mandatory-in-a-catalog-item-if-a/m-p/507923#M79702</guid>
      <dc:creator>Bart Jan Bultma</dc:creator>
      <dc:date>2021-11-02T14:16:55Z</dc:date>
    </item>
    <item>
      <title>Re: Need to make attachment mandatory in a Catalog Item if a checkbox is checked</title>
      <link>https://www.servicenow.com/community/itsm-forum/need-to-make-attachment-mandatory-in-a-catalog-item-if-a/m-p/507924#M79703</link>
      <description>&lt;P&gt;I created a Catalog Client Script, added it to the catalog item that I want it to run on, with the following code. What am I missing? I dont get the error message at all.&lt;/P&gt;
&lt;P&gt;The variable 'afstemming_met_stakeholders' is a checkbox in the form. the UI type is set to Mobile/Service Portal. Type is onSubmit and applies on Catalog Item view.&lt;/P&gt;
&lt;PRE class="language-markup"&gt;&lt;CODE&gt;function onSubmit() {
    //Type appropriate comment here, and begin script below
	var condition= g_form.getValue('afstemming_met_stakeholders');
	
	if(condition==true)
	{
		if (this.document.getElementsByClassName('get-attachment').length == 0)	
		{
			g_form.addErrorMessage('Please Attach a file');
			return false;
		}
	}
}&lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Tue, 02 Nov 2021 15:07:58 GMT</pubDate>
      <guid>https://www.servicenow.com/community/itsm-forum/need-to-make-attachment-mandatory-in-a-catalog-item-if-a/m-p/507924#M79703</guid>
      <dc:creator>Bart Jan Bultma</dc:creator>
      <dc:date>2021-11-02T15:07:58Z</dc:date>
    </item>
    <item>
      <title>Re: Need to make attachment mandatory in a Catalog Item if a checkbox is checked</title>
      <link>https://www.servicenow.com/community/itsm-forum/need-to-make-attachment-mandatory-in-a-catalog-item-if-a/m-p/507925#M79704</link>
      <description>&lt;P&gt;Solved,&amp;nbsp; condition==true had to be condition=='true'&lt;/P&gt;</description>
      <pubDate>Tue, 02 Nov 2021 15:12:38 GMT</pubDate>
      <guid>https://www.servicenow.com/community/itsm-forum/need-to-make-attachment-mandatory-in-a-catalog-item-if-a/m-p/507925#M79704</guid>
      <dc:creator>Bart Jan Bultma</dc:creator>
      <dc:date>2021-11-02T15:12:38Z</dc:date>
    </item>
    <item>
      <title>Re: Need to make attachment mandatory in a Catalog Item if a checkbox is checked</title>
      <link>https://www.servicenow.com/community/itsm-forum/need-to-make-attachment-mandatory-in-a-catalog-item-if-a/m-p/507926#M79705</link>
      <description>&lt;P&gt;I would change the g_form.addErrorMessage to:&lt;/P&gt;
&lt;P&gt;g_form.showFieldMsg(&amp;lt;field for the error&amp;gt;, &amp;lt;Message to display&amp;gt;, &amp;lt;type of message&amp;gt;)&lt;/P&gt;
&lt;P&gt;Example:&lt;/P&gt;
&lt;P&gt;g_form.showFieldMsg('afstemming_met_stakeholder', 'Please attach a file', 'error')&lt;/P&gt;</description>
      <pubDate>Tue, 26 Jul 2022 12:22:20 GMT</pubDate>
      <guid>https://www.servicenow.com/community/itsm-forum/need-to-make-attachment-mandatory-in-a-catalog-item-if-a/m-p/507926#M79705</guid>
      <dc:creator>Marco Jansen</dc:creator>
      <dc:date>2022-07-26T12:22:20Z</dc:date>
    </item>
    <item>
      <title>Re: Need to make attachment mandatory in a Catalog Item if a checkbox is checked</title>
      <link>https://www.servicenow.com/community/itsm-forum/need-to-make-attachment-mandatory-in-a-catalog-item-if-a/m-p/2589518#M496327</link>
      <description>&lt;P&gt;Thank you very much for your entry!! I've been reviewing multiple articles and was going in circles.&lt;/P&gt;</description>
      <pubDate>Thu, 15 Jun 2023 18:26:26 GMT</pubDate>
      <guid>https://www.servicenow.com/community/itsm-forum/need-to-make-attachment-mandatory-in-a-catalog-item-if-a/m-p/2589518#M496327</guid>
      <dc:creator>Stephen Marks</dc:creator>
      <dc:date>2023-06-15T18:26:26Z</dc:date>
    </item>
    <item>
      <title>Re: Need to make attachment mandatory in a Catalog Item if a checkbox is checked</title>
      <link>https://www.servicenow.com/community/itsm-forum/need-to-make-attachment-mandatory-in-a-catalog-item-if-a/m-p/2789923#M511505</link>
      <description>&lt;DIV&gt;&lt;DIV&gt;&lt;SPAN&gt;function&lt;/SPAN&gt;&lt;SPAN&gt; onSubmit() {&lt;/SPAN&gt;&lt;/DIV&gt;&lt;DIV&gt;&lt;SPAN&gt;&amp;nbsp; &amp;nbsp; &lt;/SPAN&gt;&lt;SPAN&gt;//Type appropriate comment here, and begin script below&lt;/SPAN&gt;&lt;/DIV&gt;&lt;DIV&gt;&lt;SPAN&gt;&amp;nbsp; &amp;nbsp; &lt;/SPAN&gt;&lt;SPAN&gt;var&lt;/SPAN&gt;&lt;SPAN&gt; checkboxis=g_form.getValue(&lt;/SPAN&gt;&lt;SPAN&gt;'identify_the_purpose'&lt;/SPAN&gt;&lt;SPAN&gt;);&lt;/SPAN&gt;&lt;SPAN&gt;//PAss correctly&lt;/SPAN&gt;&lt;/DIV&gt;&lt;DIV&gt;&lt;SPAN&gt;&amp;nbsp; &amp;nbsp; &lt;/SPAN&gt;&lt;SPAN&gt;if&lt;/SPAN&gt;&lt;SPAN&gt;(checkboxis==&lt;/SPAN&gt;&lt;SPAN&gt;'marriage'&lt;/SPAN&gt;&lt;SPAN&gt;) &lt;/SPAN&gt;&lt;SPAN&gt;//execute if checkbox is true&lt;/SPAN&gt;&lt;/DIV&gt;&lt;DIV&gt;&lt;SPAN&gt;&amp;nbsp; &amp;nbsp; {&lt;/SPAN&gt;&lt;/DIV&gt;&lt;DIV&gt;&lt;SPAN&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &lt;/SPAN&gt;&lt;SPAN&gt;try&lt;/SPAN&gt;&lt;SPAN&gt; { &lt;/SPAN&gt;&lt;SPAN&gt;//Works for native UI/backend&lt;/SPAN&gt;&lt;/DIV&gt;&lt;DIV&gt;&lt;SPAN&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &lt;/SPAN&gt;&lt;SPAN&gt;var&lt;/SPAN&gt;&lt;SPAN&gt; attachments = document.getElementById(&lt;/SPAN&gt;&lt;SPAN&gt;'header_attachment_list_label'&lt;/SPAN&gt;&lt;SPAN&gt;);&lt;/SPAN&gt;&lt;/DIV&gt;&lt;DIV&gt;&lt;SPAN&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &lt;/SPAN&gt;&lt;SPAN&gt;if&lt;/SPAN&gt;&lt;SPAN&gt; (attachments.style.visibility == &lt;/SPAN&gt;&lt;SPAN&gt;'hidden'&lt;/SPAN&gt;&lt;SPAN&gt; || attachments.style.display == &lt;/SPAN&gt;&lt;SPAN&gt;'none'&lt;/SPAN&gt;&lt;SPAN&gt; )&lt;/SPAN&gt;&lt;/DIV&gt;&lt;DIV&gt;&lt;SPAN&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; {&lt;/SPAN&gt;&lt;/DIV&gt;&lt;DIV&gt;&lt;SPAN&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &lt;/SPAN&gt;&lt;/DIV&gt;&lt;DIV&gt;&lt;SPAN&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; alert(&lt;/SPAN&gt;&lt;SPAN&gt;"Attachment mandatory"&lt;/SPAN&gt;&lt;SPAN&gt;);&lt;/SPAN&gt;&lt;/DIV&gt;&lt;DIV&gt;&lt;SPAN&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &lt;/SPAN&gt;&lt;SPAN&gt;return&lt;/SPAN&gt; &lt;SPAN&gt;false&lt;/SPAN&gt;&lt;SPAN&gt;;&lt;/SPAN&gt;&lt;SPAN&gt;//abort submission&lt;/SPAN&gt;&lt;/DIV&gt;&lt;DIV&gt;&lt;SPAN&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; }&lt;/SPAN&gt;&lt;/DIV&gt;&lt;DIV&gt;&lt;SPAN&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &lt;/SPAN&gt;&lt;/DIV&gt;&lt;DIV&gt;&lt;SPAN&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; }&lt;/SPAN&gt;&lt;/DIV&gt;&lt;DIV&gt;&lt;SPAN&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &lt;/SPAN&gt;&lt;SPAN&gt;catch&lt;/SPAN&gt;&lt;SPAN&gt;(e) { &lt;/SPAN&gt;&lt;SPAN&gt;//Works for Portal&lt;/SPAN&gt;&lt;/DIV&gt;&lt;DIV&gt;&lt;SPAN&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &lt;/SPAN&gt;&lt;SPAN&gt;if&lt;/SPAN&gt;&lt;SPAN&gt; ((&lt;/SPAN&gt;&lt;SPAN&gt;this&lt;/SPAN&gt;&lt;SPAN&gt;.document.getElementsByClassName(&lt;/SPAN&gt;&lt;SPAN&gt;'get-attachment'&lt;/SPAN&gt;&lt;SPAN&gt;).length == &lt;/SPAN&gt;&lt;SPAN&gt;1&lt;/SPAN&gt;&lt;SPAN&gt;) || (&lt;/SPAN&gt;&lt;SPAN&gt;this&lt;/SPAN&gt;&lt;SPAN&gt;.document.getElementsByClassName(&lt;/SPAN&gt;&lt;SPAN&gt;'get-attachment'&lt;/SPAN&gt;&lt;SPAN&gt;).length == &lt;/SPAN&gt;&lt;SPAN&gt;0&lt;/SPAN&gt;&lt;SPAN&gt;)){&lt;/SPAN&gt;&lt;/DIV&gt;&lt;DIV&gt;&lt;SPAN&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; alert(&lt;/SPAN&gt;&lt;SPAN&gt;'Attachment mandatory.'&lt;/SPAN&gt;&lt;SPAN&gt;);&lt;/SPAN&gt;&lt;/DIV&gt;&lt;DIV&gt;&lt;SPAN&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &lt;/SPAN&gt;&lt;SPAN&gt;return&lt;/SPAN&gt; &lt;SPAN&gt;false&lt;/SPAN&gt;&lt;SPAN&gt;;&lt;/SPAN&gt;&lt;/DIV&gt;&lt;DIV&gt;&lt;SPAN&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; }&lt;/SPAN&gt;&lt;/DIV&gt;&lt;DIV&gt;&lt;SPAN&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; }&lt;/SPAN&gt;&lt;/DIV&gt;&lt;DIV&gt;&lt;SPAN&gt;&amp;nbsp; &amp;nbsp; }&lt;/SPAN&gt;&lt;/DIV&gt;&lt;DIV&gt;&lt;SPAN&gt;}&lt;/SPAN&gt;&lt;/DIV&gt;&lt;/DIV&gt;</description>
      <pubDate>Fri, 12 Jan 2024 01:37:15 GMT</pubDate>
      <guid>https://www.servicenow.com/community/itsm-forum/need-to-make-attachment-mandatory-in-a-catalog-item-if-a/m-p/2789923#M511505</guid>
      <dc:creator>MADHU MSKJ</dc:creator>
      <dc:date>2024-01-12T01:37:15Z</dc:date>
    </item>
  </channel>
</rss>

