<?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 Make the Attachment variable used in the catalog item add the file to the top of case as when using the paper clip in HRSD forum</title>
    <link>https://www.servicenow.com/community/hrsd-forum/make-the-attachment-variable-used-in-the-catalog-item-add-the/m-p/1319550#M15095</link>
    <description>&lt;P&gt;Recently Servicenow added a new variable type named attachment and it works great. Here is my question. When that variable is used on the catalog item , it attaches the file in the work note in the case created. That location is different from where the files is attached when using the paper clip . Is here a way to make the new variable attachment add the file to the top of the case as when you use the paper clip?&amp;nbsp;&lt;/P&gt;</description>
    <pubDate>Tue, 16 Mar 2021 17:19:10 GMT</pubDate>
    <dc:creator>Gabriel Alowa</dc:creator>
    <dc:date>2021-03-16T17:19:10Z</dc:date>
    <item>
      <title>Make the Attachment variable used in the catalog item add the file to the top of case as when using the paper clip</title>
      <link>https://www.servicenow.com/community/hrsd-forum/make-the-attachment-variable-used-in-the-catalog-item-add-the/m-p/1319550#M15095</link>
      <description>&lt;P&gt;Recently Servicenow added a new variable type named attachment and it works great. Here is my question. When that variable is used on the catalog item , it attaches the file in the work note in the case created. That location is different from where the files is attached when using the paper clip . Is here a way to make the new variable attachment add the file to the top of the case as when you use the paper clip?&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Tue, 16 Mar 2021 17:19:10 GMT</pubDate>
      <guid>https://www.servicenow.com/community/hrsd-forum/make-the-attachment-variable-used-in-the-catalog-item-add-the/m-p/1319550#M15095</guid>
      <dc:creator>Gabriel Alowa</dc:creator>
      <dc:date>2021-03-16T17:19:10Z</dc:date>
    </item>
    <item>
      <title>Re: Make the Attachment variable used in the catalog item add the file to the top of case as when using the paper clip</title>
      <link>https://www.servicenow.com/community/hrsd-forum/make-the-attachment-variable-used-in-the-catalog-item-add-the/m-p/1319551#M15096</link>
      <description>&lt;P&gt;Hi Gabriel,&lt;/P&gt;
&lt;P&gt;I'm personally not a fan of the attachment variable type.&amp;nbsp; There may be something more to this that I'm not aware of, but from what I can see I am absolutely shocked that ServiceNow has implemented it this way.&amp;nbsp; First of all, you can only add one file, and it (almost) replicates existing functionality, so what is the point?&amp;nbsp; And putting the attachment in the Work note instead of where it belongs? Wwwhhhyyy?&amp;nbsp; So much confusion.&amp;nbsp; I've used a Macro variable with this simple XML to create an Attachments button that I can order wherever within the variables, &lt;EM&gt;and&lt;/EM&gt; it opens the same dialog window as the the paper clip, so same functionality, no excessive records on the attachments table, and they appear where you expect them to.&amp;nbsp; This method doesn't work in Service Portal since Macro variables are not supported.&lt;/P&gt;
&lt;PRE class="language-markup"&gt;&lt;CODE&gt;&amp;lt;?xml version="1.0" encoding="utf-8" ?&amp;gt;
&amp;lt;j:jelly trim="false" xmlns:j="jelly:core" xmlns:g="glide" xmlns:j2="null" xmlns:g2="null"&amp;gt;
	
	&amp;lt;button class="request_catalog_button_with_icon btn cat-btn btn-primary" onclick='attach()'&amp;gt;Attachments&amp;lt;/button&amp;gt;
		
    &amp;lt;script language="javascript"&amp;gt;
        
		function attach() {
			saveCatAttachment(gel('sysparm_item_guid').value, 'sc_cart_item');
		}
		   
    &amp;lt;/script&amp;gt;
	&amp;lt;!-- 	&amp;lt;/td&amp;gt;&amp;lt;/tr&amp;gt;&amp;lt;/table&amp;gt; --&amp;gt;
&amp;lt;/j:jelly&amp;gt;&lt;/CODE&gt;&lt;/PRE&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/132299iF0F2C5683710C514/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;The thing I'm most shocked about is that when you attach your one file on the request form then submit the item, you will see in the sys_attachment table that there are now &lt;STRONG&gt;TWO&lt;/STRONG&gt; records for the same file - the very thing they preach against the copy attachment utility - they're unnecessarily bloating the database unbeknownst to most.&amp;nbsp; The ZZ_YYsc_cart_item record serves no purpose and should be deleted when the RITM and it's attachment are created, if they're going to do it that way.&lt;/P&gt;
&lt;P&gt;If you prefer the look/functionality of the variable over a UI Macro button, a simple before or after Insert Business Rule on the sys_attachment table &lt;EM&gt;should&lt;/EM&gt; put the attachment where it belongs and should have been in the first place, but there seems to be something in place preventing this from working, so there's more than one way to skin this cat.&amp;nbsp; Create an after Insert Business Rule on the sc_req_item table, with no Filter Conditions.&amp;nbsp; Your script will look like this.&lt;/P&gt;
&lt;PRE class="language-javascript"&gt;&lt;CODE&gt;(function executeRule(current, previous /*null when async*/) {
	var attach = new GlideRecord('sys_attachment');
	attach.addQuery('table_name', 'ZZ_YYsc_req_item');
	attach.addQuery('table_sys_id', current.sys_id);
	attach.query();
	while(attach.next()){
		attach.table_name = 'sc_req_item';
		attach.update();
	}
})(current, previous);&lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Tue, 16 Mar 2021 20:43:59 GMT</pubDate>
      <guid>https://www.servicenow.com/community/hrsd-forum/make-the-attachment-variable-used-in-the-catalog-item-add-the/m-p/1319551#M15096</guid>
      <dc:creator>Brad Bowman</dc:creator>
      <dc:date>2021-03-16T20:43:59Z</dc:date>
    </item>
    <item>
      <title>Re: Make the Attachment variable used in the catalog item add the file to the top of case as when using the paper clip</title>
      <link>https://www.servicenow.com/community/hrsd-forum/make-the-attachment-variable-used-in-the-catalog-item-add-the/m-p/1319552#M15097</link>
      <description>&lt;P&gt;Thank you Brad&lt;/P&gt;
&lt;P&gt;My intend here was to be able to make that attachment mandatory when some values are selected on the preview variable and when I saw this new attachment variable , I said horah but that was too soon. Do you or anyone found a way to make this paper clip mandatory only for some other variable value on the catalog? In case I have to go back to the paper clip&lt;/P&gt;</description>
      <pubDate>Wed, 17 Mar 2021 14:15:19 GMT</pubDate>
      <guid>https://www.servicenow.com/community/hrsd-forum/make-the-attachment-variable-used-in-the-catalog-item-add-the/m-p/1319552#M15097</guid>
      <dc:creator>Gabriel Alowa</dc:creator>
      <dc:date>2021-03-17T14:15:19Z</dc:date>
    </item>
    <item>
      <title>Re: Make the Attachment variable used in the catalog item add the file to the top of case as when using the paper clip</title>
      <link>https://www.servicenow.com/community/hrsd-forum/make-the-attachment-variable-used-in-the-catalog-item-add-the/m-p/1319553#M15098</link>
      <description>&lt;P&gt;Are you using the native UI, Service Portal, or both? Do you have a script to make the variable mandatory under these conditions?&lt;/P&gt;</description>
      <pubDate>Wed, 17 Mar 2021 14:43:55 GMT</pubDate>
      <guid>https://www.servicenow.com/community/hrsd-forum/make-the-attachment-variable-used-in-the-catalog-item-add-the/m-p/1319553#M15098</guid>
      <dc:creator>Brad Bowman</dc:creator>
      <dc:date>2021-03-17T14:43:55Z</dc:date>
    </item>
    <item>
      <title>Re: Make the Attachment variable used in the catalog item add the file to the top of case as when using the paper clip</title>
      <link>https://www.servicenow.com/community/hrsd-forum/make-the-attachment-variable-used-in-the-catalog-item-add-the/m-p/1319554#M15099</link>
      <description>&lt;P&gt;I am using both , I have created catalog UI policy with the catalog UI poly actions to make the variable mandatory . I want to say that I like the look of the new attachment variable but not sure how to properly use the script you provided me with. What table to use.&lt;/P&gt;
&lt;P&gt;var attach = new GlideRecord('sys_attachment');&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; attach.addQuery('&lt;SPAN style="color: #ff6600;"&gt;table_name&lt;/SPAN&gt;', '&lt;SPAN style="color: #ff6600;"&gt;ZZ_YYsc_req_item&lt;/SPAN&gt;');&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; attach.addQuery('table_sys_id', current.sys_id);&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; attach.query();&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; while(attach.next()){&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; attach.table_name = 'sc_req_item';&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; attach.update();&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Thank you for your help on this&lt;/P&gt;</description>
      <pubDate>Wed, 17 Mar 2021 14:56:15 GMT</pubDate>
      <guid>https://www.servicenow.com/community/hrsd-forum/make-the-attachment-variable-used-in-the-catalog-item-add-the/m-p/1319554#M15099</guid>
      <dc:creator>Gabriel Alowa</dc:creator>
      <dc:date>2021-03-17T14:56:15Z</dc:date>
    </item>
    <item>
      <title>Re: Make the Attachment variable used in the catalog item add the file to the top of case as when using the paper clip</title>
      <link>https://www.servicenow.com/community/hrsd-forum/make-the-attachment-variable-used-in-the-catalog-item-add-the/m-p/1319555#M15100</link>
      <description>&lt;P&gt;&lt;SN-MENTION class="sn-mention" table="live_profile" sysid="8ebeccb6db6cd010f7fca851ca9619bf"&gt;@Gabriel Alowa&lt;/SN-MENTION&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;I have shared working solution in this link below&lt;/P&gt;
&lt;P&gt;&lt;A href="https://community.servicenow.com/community?id=community_question&amp;amp;sys_id=41af7501db1ea010fa192183ca961983" target="_blank"&gt; Disable ZZ_YY prefix from attachment when added through record producer &lt;/A&gt;&lt;/P&gt;
&lt;P&gt;Adding the same here for your reference:&lt;/P&gt;
&lt;P&gt;1) I created Async After Insert BR on the sc_req_item table&lt;/P&gt;
&lt;P&gt;2) Script as this&lt;/P&gt;
&lt;P&gt;a) Remove the ZZ_YY&lt;/P&gt;
&lt;P&gt;b) Then use the Copy Attachment functionality&lt;/P&gt;
&lt;PRE class="language-javascript"&gt;&lt;CODE&gt;(function executeRule(current, previous /*null when async*/) {

	// Add your code here
	var gr = new GlideRecord("sys_attachment");
	gr.addQuery("table_name", "ZZ_YY" + current.getTableName());
	gr.addQuery("table_sys_id", current.sys_id);
	gr.query();
	if (gr.next()) {
		gr.table_name = current.getTableName();
		gr.update();
		new global.VariableUtil().copy(gr.sys_id, current.getTableName(), current.sys_id); 
	}

})(current, previous);&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;Regards&lt;BR /&gt;Ankur&lt;/P&gt;</description>
      <pubDate>Wed, 17 Mar 2021 15:04:38 GMT</pubDate>
      <guid>https://www.servicenow.com/community/hrsd-forum/make-the-attachment-variable-used-in-the-catalog-item-add-the/m-p/1319555#M15100</guid>
      <dc:creator>Ankur Bawiskar</dc:creator>
      <dc:date>2021-03-17T15:04:38Z</dc:date>
    </item>
    <item>
      <title>Re: Make the Attachment variable used in the catalog item add the file to the top of case as when using the paper clip</title>
      <link>https://www.servicenow.com/community/hrsd-forum/make-the-attachment-variable-used-in-the-catalog-item-add-the/m-p/1319556#M15101</link>
      <description>&lt;P&gt;This will run after your request form is submitted, and after the RITM has been created, so it runs on the sc_req_item table&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/132293i3D99071F71B32644/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;I have an onSubmit Catalog Client script that works well in the native UI.&amp;nbsp; It calls a GlideAjax Script Include, then prevents submission if there is not an attachment, so you could apply your criteria to that, but there are different issues with the Service Portal.&amp;nbsp; Nothing insurmountable, but it sounds like it's best to use the Business Rule in your case, and hit me up later if you decide to go back to the paper clip icon.&lt;/P&gt;</description>
      <pubDate>Wed, 17 Mar 2021 15:07:51 GMT</pubDate>
      <guid>https://www.servicenow.com/community/hrsd-forum/make-the-attachment-variable-used-in-the-catalog-item-add-the/m-p/1319556#M15101</guid>
      <dc:creator>Brad Bowman</dc:creator>
      <dc:date>2021-03-17T15:07:51Z</dc:date>
    </item>
    <item>
      <title>Re: Make the Attachment variable used in the catalog item add the file to the top of case as when using the paper clip</title>
      <link>https://www.servicenow.com/community/hrsd-forum/make-the-attachment-variable-used-in-the-catalog-item-add-the/m-p/1319557#M15102</link>
      <description>&lt;P&gt;As you can see below I follow instruction from the scrip but it is getting attached only in the ZZ_YY table_name. What Am I missing ?&amp;nbsp; should I change the table name in the scripts?&lt;/P&gt;
&lt;P&gt;Thank you&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/132294i54A605A0DC30B5E3/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;</description>
      <pubDate>Wed, 17 Mar 2021 18:19:55 GMT</pubDate>
      <guid>https://www.servicenow.com/community/hrsd-forum/make-the-attachment-variable-used-in-the-catalog-item-add-the/m-p/1319557#M15102</guid>
      <dc:creator>Gabriel Alowa</dc:creator>
      <dc:date>2021-03-17T18:19:55Z</dc:date>
    </item>
    <item>
      <title>Re: Make the Attachment variable used in the catalog item add the file to the top of case as when using the paper clip</title>
      <link>https://www.servicenow.com/community/hrsd-forum/make-the-attachment-variable-used-in-the-catalog-item-add-the/m-p/1319558#M15103</link>
      <description>&lt;P&gt;Yes, change the table name in 2 places in the Business Rule script (once with the ZZ_YY, and once without per the sc_req_item example, then change the Business Rule to run on the sn_hr_core_case_workforce_admin table instead of sc_req_item.&lt;/P&gt;</description>
      <pubDate>Wed, 17 Mar 2021 19:23:31 GMT</pubDate>
      <guid>https://www.servicenow.com/community/hrsd-forum/make-the-attachment-variable-used-in-the-catalog-item-add-the/m-p/1319558#M15103</guid>
      <dc:creator>Brad Bowman</dc:creator>
      <dc:date>2021-03-17T19:23:31Z</dc:date>
    </item>
    <item>
      <title>Re: Make the Attachment variable used in the catalog item add the file to the top of case as when using the paper clip</title>
      <link>https://www.servicenow.com/community/hrsd-forum/make-the-attachment-variable-used-in-the-catalog-item-add-the/m-p/1319559#M15104</link>
      <description>&lt;P&gt;&lt;SN-MENTION class="sn-mention" table="live_profile" sysid="8ebeccb6db6cd010f7fca851ca9619bf"&gt;@Gabriel Alowa&lt;/SN-MENTION&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;yes please change it as I have shared in my script if you are referring that.&lt;/P&gt;
&lt;P&gt;Regards&lt;BR /&gt;Ankur&lt;/P&gt;</description>
      <pubDate>Thu, 18 Mar 2021 03:39:49 GMT</pubDate>
      <guid>https://www.servicenow.com/community/hrsd-forum/make-the-attachment-variable-used-in-the-catalog-item-add-the/m-p/1319559#M15104</guid>
      <dc:creator>Ankur Bawiskar</dc:creator>
      <dc:date>2021-03-18T03:39:49Z</dc:date>
    </item>
    <item>
      <title>Re: Make the Attachment variable used in the catalog item add the file to the top of case as when using the paper clip</title>
      <link>https://www.servicenow.com/community/hrsd-forum/make-the-attachment-variable-used-in-the-catalog-item-add-the/m-p/1319560#M15105</link>
      <description>&lt;P&gt;Hey Brad,&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;I'm on the same boat. Not a fan of Attachment variable for the reasons you mentioned.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Since Macro's aren't supported on Portal, any ideas on how to&amp;nbsp;replicate the functionality of opening paper clip Add Attachment (SC Catalog Item widget) when clicking on a custom button on portal?&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;I tried a Macro with Widget and it didn't work.&lt;/P&gt;</description>
      <pubDate>Thu, 09 Jun 2022 04:26:41 GMT</pubDate>
      <guid>https://www.servicenow.com/community/hrsd-forum/make-the-attachment-variable-used-in-the-catalog-item-add-the/m-p/1319560#M15105</guid>
      <dc:creator>Lakshmi Royyala</dc:creator>
      <dc:date>2022-06-09T04:26:41Z</dc:date>
    </item>
    <item>
      <title>Re: Make the Attachment variable used in the catalog item add the file to the top of case as when us</title>
      <link>https://www.servicenow.com/community/hrsd-forum/make-the-attachment-variable-used-in-the-catalog-item-add-the/m-p/2454941#M27942</link>
      <description>&lt;P&gt;If anyone else is seeing this in 2023, the VariableUtil.copy() method is now VariableUtil.copyAttachment(). so you'll need to modify this line from:&lt;/P&gt;&lt;PRE&gt;new global.VariableUtil().copy(gr.sys_id, current.getTableName(), current.sys_id); &lt;/PRE&gt;&lt;P&gt;to:&lt;/P&gt;&lt;PRE&gt;new global.VariableUtil().copyAttachment(gr.sys_id, current.getTableName(), current.sys_id);&lt;/PRE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Not a huge fan of this functionality either, but this will make the BR above work again.&lt;/P&gt;</description>
      <pubDate>Mon, 23 Jan 2023 22:56:25 GMT</pubDate>
      <guid>https://www.servicenow.com/community/hrsd-forum/make-the-attachment-variable-used-in-the-catalog-item-add-the/m-p/2454941#M27942</guid>
      <dc:creator>davidpridemore1</dc:creator>
      <dc:date>2023-01-23T22:56:25Z</dc:date>
    </item>
    <item>
      <title>Re: Make the Attachment variable used in the catalog item add the file to the top of case as when us</title>
      <link>https://www.servicenow.com/community/hrsd-forum/make-the-attachment-variable-used-in-the-catalog-item-add-the/m-p/2781368#M33959</link>
      <description>&lt;P&gt;hello ankur,&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;i have the same query related to attachment variable. The attachment is getting downloaded by admin and not by any ITIL User. Is there any possible troubleshooting i can do to find the cause. I have posted one question also.&lt;/P&gt;&lt;P&gt;&lt;A href="https://www.servicenow.com/community/incident-management-forum/attachment-not-able-to-download-from-ritm/m-p/2781257#M7333" target="_blank"&gt;Re: Attachment not able to download from RITM - ServiceNow Community&lt;/A&gt;&lt;/P&gt;</description>
      <pubDate>Fri, 05 Jan 2024 00:12:21 GMT</pubDate>
      <guid>https://www.servicenow.com/community/hrsd-forum/make-the-attachment-variable-used-in-the-catalog-item-add-the/m-p/2781368#M33959</guid>
      <dc:creator>deepika46</dc:creator>
      <dc:date>2024-01-05T00:12:21Z</dc:date>
    </item>
    <item>
      <title>Re: Make the Attachment variable used in the catalog item add the file to the top of case as when us</title>
      <link>https://www.servicenow.com/community/hrsd-forum/make-the-attachment-variable-used-in-the-catalog-item-add-the/m-p/2781369#M33960</link>
      <description>&lt;P&gt;hello Brad,&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;i have the same query related to attachment variable. The attachment is getting downloaded by admin and not by any ITIL User. Is there any possible troubleshooting i can do to find the cause. I have posted one question also.&lt;/P&gt;&lt;P&gt;&lt;A href="https://www.servicenow.com/community/incident-management-forum/attachment-not-able-to-download-from-ritm/m-p/2781257#M7333" target="_blank"&gt;Re: Attachment not able to download from RITM - ServiceNow Community&lt;/A&gt;&lt;/P&gt;</description>
      <pubDate>Fri, 05 Jan 2024 00:12:58 GMT</pubDate>
      <guid>https://www.servicenow.com/community/hrsd-forum/make-the-attachment-variable-used-in-the-catalog-item-add-the/m-p/2781369#M33960</guid>
      <dc:creator>deepika46</dc:creator>
      <dc:date>2024-01-05T00:12:58Z</dc:date>
    </item>
    <item>
      <title>Re: Make the Attachment variable used in the catalog item add the file to the top of case as when us</title>
      <link>https://www.servicenow.com/community/hrsd-forum/make-the-attachment-variable-used-in-the-catalog-item-add-the/m-p/3007806#M37973</link>
      <description>&lt;P&gt;i have two attachment buttons on my form but this code will only work for one of them while the other attachment shows still as ZZ_YY&lt;/P&gt;</description>
      <pubDate>Fri, 02 Aug 2024 15:12:11 GMT</pubDate>
      <guid>https://www.servicenow.com/community/hrsd-forum/make-the-attachment-variable-used-in-the-catalog-item-add-the/m-p/3007806#M37973</guid>
      <dc:creator>Peter Williams</dc:creator>
      <dc:date>2024-08-02T15:12:11Z</dc:date>
    </item>
    <item>
      <title>Re: Make the Attachment variable used in the catalog item add the file to the top of case as when us</title>
      <link>https://www.servicenow.com/community/hrsd-forum/make-the-attachment-variable-used-in-the-catalog-item-add-the/m-p/3007903#M37974</link>
      <description>&lt;P&gt;It sounds like you have two records that meet the GlideRecord criteria, so try changing the&amp;nbsp;&lt;/P&gt;
&lt;LI-CODE lang="javascript"&gt;	if (gr.next()) {
&lt;/LI-CODE&gt;
&lt;P&gt;&amp;nbsp;to&amp;nbsp;&lt;/P&gt;
&lt;LI-CODE lang="javascript"&gt;	while (gr.next()) {
&lt;/LI-CODE&gt;
&lt;P&gt;or else look at the attachment table to see how the record that isn't getting changed differs, then add that as a second GlideRecord query.&amp;nbsp; Also see the update that the copy function in the referenced Script Include has been renamed to copyAttachment.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Fri, 02 Aug 2024 17:08:46 GMT</pubDate>
      <guid>https://www.servicenow.com/community/hrsd-forum/make-the-attachment-variable-used-in-the-catalog-item-add-the/m-p/3007903#M37974</guid>
      <dc:creator>Brad Bowman</dc:creator>
      <dc:date>2024-08-02T17:08:46Z</dc:date>
    </item>
    <item>
      <title>Re: Make the Attachment variable used in the catalog item add the file to the top of case as when us</title>
      <link>https://www.servicenow.com/community/hrsd-forum/make-the-attachment-variable-used-in-the-catalog-item-add-the/m-p/3007906#M37975</link>
      <description>&lt;P&gt;i tried that and it causing the attachment to double meaning if i have 2 attachemtns from the two buttons it will be 4 attachment. duplicates&lt;/P&gt;</description>
      <pubDate>Fri, 02 Aug 2024 17:10:44 GMT</pubDate>
      <guid>https://www.servicenow.com/community/hrsd-forum/make-the-attachment-variable-used-in-the-catalog-item-add-the/m-p/3007906#M37975</guid>
      <dc:creator>Peter Williams</dc:creator>
      <dc:date>2024-08-02T17:10:44Z</dc:date>
    </item>
    <item>
      <title>Re: Make the Attachment variable used in the catalog item add the file to the top of case as when us</title>
      <link>https://www.servicenow.com/community/hrsd-forum/make-the-attachment-variable-used-in-the-catalog-item-add-the/m-p/3007908#M37976</link>
      <description>&lt;P&gt;but i think i found the solution for it&lt;/P&gt;&lt;P&gt;here is my updated code&lt;BR /&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;/P&gt;&lt;P&gt;(function executeRule(current, previous /*null when async*/) {&lt;BR /&gt;// Add your code here&lt;BR /&gt;var attachmentIDs = [];&lt;/P&gt;&lt;P&gt;var gr = new GlideRecord("sys_attachment");&lt;BR /&gt;gr.addQuery("table_name", "ZZ_YY" + current.getTableName());&lt;BR /&gt;gr.addQuery("table_sys_id", current.sys_id);&lt;BR /&gt;gr.query();&lt;/P&gt;&lt;P&gt;// Collect the attachment sys_ids&lt;BR /&gt;while (gr.next()) {&lt;BR /&gt;attachmentIDs.push(gr.sys_id.toString());&lt;BR /&gt;}&lt;/P&gt;&lt;P&gt;// Copy attachments using the collected sys_ids&lt;BR /&gt;for (var i = 0; i &amp;lt; attachmentIDs.length; i++) {&lt;BR /&gt;var attachment = new GlideRecord("sys_attachment");&lt;BR /&gt;if (attachment.get(attachmentIDs[i])) {&lt;BR /&gt;new global.VariableUtil().copyAttachment(attachment.sys_id, current.getTableName(), current.sys_id);&lt;BR /&gt;}&lt;BR /&gt;}&lt;BR /&gt;})(current, previous);&lt;/P&gt;</description>
      <pubDate>Fri, 02 Aug 2024 17:14:23 GMT</pubDate>
      <guid>https://www.servicenow.com/community/hrsd-forum/make-the-attachment-variable-used-in-the-catalog-item-add-the/m-p/3007908#M37976</guid>
      <dc:creator>Peter Williams</dc:creator>
      <dc:date>2024-08-02T17:14:23Z</dc:date>
    </item>
  </channel>
</rss>

