<script custom-tag="" type="application/ld+json">{"@context":"https://schema.org","@type":"TechArticle","headline":"'Add Attachment' button on catalog that works on both request catalog item form and RITM form.","image":"http://support.servicenow.com/29f1d2661baf6010cafa53d8624bcb43.iix","author":{"name":"ServiceNow Support","url":"http://support.servicenow.com/now"},"keywords":"ServiceNow, NowSupport public Knowledge Base articles, Support and Troubleshooting,KB0791202,save,Attachment,macro, ui, catalog,RITM","wordcount":"217","publisher":"ServiceNow","url":"https://support.servicenow.com/kb?id=kb_article_view&sysparm_article=KB0791202","datePublished":"2019-12-29","dateCreated":"2019-12-28","dateModified":"2022-05-20","description":"<h2>'Add Attachment' button on catalog that works on both request catalog item form and RITM form.</h2><br/><div style=\"overflow-x:auto\"><article><div ><h3 >Summary</h3><section><p>This article descri","articleBody":"<h2>'Add Attachment' button on catalog that works on both request catalog item form and RITM form.</h2><br/><div style=\"overflow-x:auto\"><article><div ><h3 >Summary</h3><section><p>This article describes on how to create a UI macro type variable to attach attachments. This works on both the request catalog form and the RITM form.</p>\r\n<p> </p></section></div><div ><h3 >Release</h3><section><p>All Versions</p></section></div><div ><h3 >Instructions</h3><section><p>1) Navigate to System UI &gt; UI macros<br />2) Click New.<br />3) Provide a Name such as Add_Attachment_Var.<br />4) In the XML section, copy the paste the following</p>\r\n<p><span style=\"background-color: #000000; color: #ffffff;\">&lt;?xml version&#61;&#34;1.0&#34; encoding&#61;&#34;utf-8&#34; ?&gt;</span><br /><span style=\"background-color: #000000; color: #ffffff;\">&lt;j:jelly trim&#61;&#34;false&#34; xmlns:j&#61;&#34;jelly:core&#34; xmlns:g&#61;&#34;glide&#34; xmlns:j2&#61;&#34;null&#34; xmlns:g2&#61;&#34;null&#34;&gt;</span><br /><span style=\"background-color: #000000; color: #ffffff;\">&lt;button style&#61;&#34;background: #C0C0C0; border-color: darkgrey; color: #3f464f; height:30; width:70&#34;</span><br /><span style=\"background-color: #000000; color: #ffffff;\">onclick&#61;&#34;saveCustomAttachment();return false&#34;&gt;</span><br /><span style=\"background-color: #000000; color: #ffffff;\">&lt;b&gt;Please attach file&lt;/b&gt;</span><br /><span style=\"background-color: #000000; color: #ffffff;\">&lt;/button&gt;</span><br /><span style=\"background-color: #000000; color: #ffffff;\">&lt;script&gt;</span><br /><span style=\"background-color: #000000; color: #ffffff;\">function saveCustomAttachment(){</span><br /><span style=\"background-color: #000000; color: #ffffff;\">var tableName &#61; g_form.getTableName();</span><br /><span style=\"background-color: #000000; color: #ffffff;\">var sys_id_input &#61; gel(&#39;sysparm_item_guid&#39;) ? gel(&#39;sysparm_item_guid&#39;).value : g_form.getUniqueValue();</span><br /><span style=\"background-color: #000000; color: #ffffff;\">if(tableName &#61;&#61;&#61; &#34;ni&#34;){</span><br /><span style=\"background-color: #000000; color: #ffffff;\">saveCatAttachment(sys_id_input, &#39;sc_cart_item&#39;);</span><br /><span style=\"background-color: #000000; color: #ffffff;\">}else{</span><br /><span style=\"background-color: #000000; color: #ffffff;\">saveAttachment(&#39;sc_req_item&#39;, sys_id_input);</span><br /><span style=\"background-color: #000000; color: #ffffff;\">}</span><br /><span style=\"background-color: #000000; color: #ffffff;\">}</span><br /><span style=\"background-color: #000000; color: #ffffff;\">&lt;/script&gt;</span><br /><span style=\"background-color: #000000; color: #ffffff;\">&lt;/j:jelly&gt;</span></p>\r\n<p>5) Using this Add_Attachment_Var macro , create a new macro type catalog variable in the required catalog item.</p></section></div></article></div>"}</script>
  Loading...