<?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: Get value of attachment from Record producer in record producer script in Developer forum</title>
    <link>https://www.servicenow.com/community/developer-forum/get-value-of-attachment-from-record-producer-in-record-producer/m-p/3330613#M1217482</link>
    <description>&lt;P&gt;Thanks, this worked for me but I had to first identify to which table my attachment was attaching to when I add it on the catalog item form. It seems like it is same as record producer's table.&amp;nbsp;&lt;/P&gt;&lt;P&gt;Since I have my record producer on Incident table I ran your script something like below.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;LI-CODE lang="javascript"&gt;var sa - new GlideSysAttachment();
sa.copy('incident',current.sys_id,'request', 'SYSID of Request');&lt;/LI-CODE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Thanks again for helping me out here.&lt;/P&gt;</description>
    <pubDate>Tue, 22 Jul 2025 12:31:22 GMT</pubDate>
    <dc:creator>Utpal Dutta</dc:creator>
    <dc:date>2025-07-22T12:31:22Z</dc:date>
    <item>
      <title>Get value of attachment from Record producer in record producer script</title>
      <link>https://www.servicenow.com/community/developer-forum/get-value-of-attachment-from-record-producer-in-record-producer/m-p/3330070#M1217343</link>
      <description>&lt;P&gt;Hi community members,&lt;/P&gt;&lt;P&gt;I'm working on a record producer where I need to get value of "Attachment" in my record producer script.&lt;/P&gt;&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="UtpalDutta_0-1753164768441.png" style="width: 400px;"&gt;&lt;img src="https://www.servicenow.com/community/image/serverpage/image-id/457494i4C0D7A5162DC376F/image-size/medium?v=v2&amp;amp;px=400" role="button" title="UtpalDutta_0-1753164768441.png" alt="UtpalDutta_0-1753164768441.png" /&gt;&lt;/span&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I need this because I'm aboring action of record producer and inserting that record somewhere else. When I'm inserting that record I need the attachment which is added by the user in Record producer to be attached in that record.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Any ideas or suggestions are helpful.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Thanks&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Tue, 22 Jul 2025 06:14:14 GMT</pubDate>
      <guid>https://www.servicenow.com/community/developer-forum/get-value-of-attachment-from-record-producer-in-record-producer/m-p/3330070#M1217343</guid>
      <dc:creator>Utpal Dutta</dc:creator>
      <dc:date>2025-07-22T06:14:14Z</dc:date>
    </item>
    <item>
      <title>Re: Get value of attachment from Record producer in record producer script</title>
      <link>https://www.servicenow.com/community/developer-forum/get-value-of-attachment-from-record-producer-in-record-producer/m-p/3330076#M1217344</link>
      <description>&lt;P&gt;Hello&amp;nbsp;&lt;a href="https://www.servicenow.com/community/user/viewprofilepage/user-id/270394"&gt;@Utpal Dutta&lt;/a&gt;,&lt;BR /&gt;&lt;BR /&gt;In which record you want to add that attachment? Selected record producer table or somewhere else?&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;Thanks&lt;/SPAN&gt;&lt;/P&gt;</description>
      <pubDate>Tue, 22 Jul 2025 06:23:31 GMT</pubDate>
      <guid>https://www.servicenow.com/community/developer-forum/get-value-of-attachment-from-record-producer-in-record-producer/m-p/3330076#M1217344</guid>
      <dc:creator>Community Alums</dc:creator>
      <dc:date>2025-07-22T06:23:31Z</dc:date>
    </item>
    <item>
      <title>Re: Get value of attachment from Record producer in record producer script</title>
      <link>https://www.servicenow.com/community/developer-forum/get-value-of-attachment-from-record-producer-in-record-producer/m-p/3330082#M1217346</link>
      <description>&lt;P&gt;&lt;a href="https://www.servicenow.com/community/user/viewprofilepage/user-id/270394"&gt;@Utpal Dutta&lt;/a&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;what do you want to do with that attachment?&lt;/P&gt;
&lt;P&gt;what's your business requirement?&lt;/P&gt;
&lt;P&gt;If my response helped please mark it correct and close the thread so that it benefits future readers.&lt;/P&gt;</description>
      <pubDate>Tue, 22 Jul 2025 06:25:55 GMT</pubDate>
      <guid>https://www.servicenow.com/community/developer-forum/get-value-of-attachment-from-record-producer-in-record-producer/m-p/3330082#M1217346</guid>
      <dc:creator>Ankur Bawiskar</dc:creator>
      <dc:date>2025-07-22T06:25:55Z</dc:date>
    </item>
    <item>
      <title>Re: Get value of attachment from Record producer in record producer script</title>
      <link>https://www.servicenow.com/community/developer-forum/get-value-of-attachment-from-record-producer-in-record-producer/m-p/3330084#M1217347</link>
      <description>&lt;P&gt;Hi&amp;nbsp;&lt;a href="https://www.servicenow.com/community/user/viewprofilepage/user-id/270394"&gt;@Utpal Dutta&lt;/a&gt;&amp;nbsp;,&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;when you add an attachment to the record producer it will add it to sys_attachment table with table name as the record producer tableName and sysid = sysid of the task which is not yet generated ( this sysid will be allocated to to the record once you submit the record)&lt;/P&gt;&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="ChaitanyaILCR_0-1753165324523.png" style="width: 400px;"&gt;&lt;img src="https://www.servicenow.com/community/image/serverpage/image-id/457495iAD0DCFB0EF121488/image-size/medium?v=v2&amp;amp;px=400" role="button" title="ChaitanyaILCR_0-1753165324523.png" alt="ChaitanyaILCR_0-1753165324523.png" /&gt;&lt;/span&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;it's not recommend to use the setAbortaction method inside record producer script and might not work as intended as per docs&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;so better create a before insert BR on the table&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;EM&gt;Please mark my answer as&lt;SPAN&gt;&amp;nbsp;&lt;/SPAN&gt;&lt;STRONG&gt;&lt;FONT color="#008000"&gt;helpful/correct&lt;SPAN&gt;&amp;nbsp;&lt;/SPAN&gt;&lt;/FONT&gt;&lt;/STRONG&gt;if it resolves your query.&lt;/EM&gt;&lt;/P&gt;&lt;P&gt;&lt;I&gt;Regards,&lt;BR /&gt;Chaitanya&lt;/I&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Tue, 22 Jul 2025 06:26:34 GMT</pubDate>
      <guid>https://www.servicenow.com/community/developer-forum/get-value-of-attachment-from-record-producer-in-record-producer/m-p/3330084#M1217347</guid>
      <dc:creator>Chaitanya ILCR</dc:creator>
      <dc:date>2025-07-22T06:26:34Z</dc:date>
    </item>
    <item>
      <title>Re: Get value of attachment from Record producer in record producer script</title>
      <link>https://www.servicenow.com/community/developer-forum/get-value-of-attachment-from-record-producer-in-record-producer/m-p/3330090#M1217350</link>
      <description>&lt;P&gt;Hello&amp;nbsp;&lt;a href="https://www.servicenow.com/community/user/viewprofilepage/user-id/270394"&gt;@Utpal Dutta&lt;/a&gt;&amp;nbsp;,&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;In addition to&amp;nbsp;&lt;a href="https://www.servicenow.com/community/user/viewprofilepage/user-id/24805"&gt;@Chaitanya ILCR&lt;/a&gt;&amp;nbsp;point, you can copy the attachment from one table to another table using Glidesysattachment method.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;LI-CODE lang="javascript"&gt;// For example

var attachment = new GlideSysAttachment();
var incidentSysID = 'ab1b30031b04ec101363ff37dc4bcbfc';
var incGR = new GlideRecord('incident');
incGR.get(incidentSysID);

var copiedAttachments = attachment.copy('incident', incidentSysID, 'problem', incGR.getValue('problem_id'));
gs.info('Copied attachments: ' + copiedAttachments);&lt;/LI-CODE&gt;</description>
      <pubDate>Tue, 22 Jul 2025 06:28:47 GMT</pubDate>
      <guid>https://www.servicenow.com/community/developer-forum/get-value-of-attachment-from-record-producer-in-record-producer/m-p/3330090#M1217350</guid>
      <dc:creator>Shraddha Kadam</dc:creator>
      <dc:date>2025-07-22T06:28:47Z</dc:date>
    </item>
    <item>
      <title>Re: Get value of attachment from Record producer in record producer script</title>
      <link>https://www.servicenow.com/community/developer-forum/get-value-of-attachment-from-record-producer-in-record-producer/m-p/3330107#M1217355</link>
      <description>&lt;P&gt;Hi&amp;nbsp;&lt;a href="https://www.servicenow.com/community/user/viewprofilepage/user-id/270394"&gt;@Utpal Dutta&lt;/a&gt;,&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;step1: Open your record producer&lt;/P&gt;&lt;P&gt;specify record producer if you are working on (eg.issue management- Record Producer)&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;step2. add the script to the Record producer&lt;/P&gt;&lt;P&gt;Here is the script to copy attachments in Record Producer&lt;/P&gt;&lt;LI-CODE lang="javascript"&gt;var newRec = new GlideRecord 'incident);//or any other table
newRec.short-description = 'created from Record producer';
newRec.description ='This record was created through a producer';
newRec.insert();


//Now copy attachments from the record producer to the new record

var sa - new GlideSysAttachment();
sa.copy('sc_item_produced_record',current.sys_id,newRec.getTableName(), newRec.sys_id);
//adjust source table name in teh .copy() line if needed&lt;/LI-CODE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;use 'sc_item_produced_record' if the attachement is saved there&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;step3: save the Record Producer&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Testing:&lt;/P&gt;&lt;P&gt;1.Service catalog-&amp;gt; record producer and fill the form and attach a file -&amp;gt; submit&lt;/P&gt;&lt;P&gt;&amp;nbsp;2. go to the target table (eg.incident in this example )&lt;/P&gt;&lt;P&gt;3. open a new record and check if the attachment is present.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;Please mark as Correct Answer/Helpful, if applicable.&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;ServiceNow Developer&lt;/STRONG&gt;&lt;/P&gt;</description>
      <pubDate>Tue, 22 Jul 2025 06:40:05 GMT</pubDate>
      <guid>https://www.servicenow.com/community/developer-forum/get-value-of-attachment-from-record-producer-in-record-producer/m-p/3330107#M1217355</guid>
      <dc:creator>Community Alums</dc:creator>
      <dc:date>2025-07-22T06:40:05Z</dc:date>
    </item>
    <item>
      <title>Re: Get value of attachment from Record producer in record producer script</title>
      <link>https://www.servicenow.com/community/developer-forum/get-value-of-attachment-from-record-producer-in-record-producer/m-p/3330613#M1217482</link>
      <description>&lt;P&gt;Thanks, this worked for me but I had to first identify to which table my attachment was attaching to when I add it on the catalog item form. It seems like it is same as record producer's table.&amp;nbsp;&lt;/P&gt;&lt;P&gt;Since I have my record producer on Incident table I ran your script something like below.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;LI-CODE lang="javascript"&gt;var sa - new GlideSysAttachment();
sa.copy('incident',current.sys_id,'request', 'SYSID of Request');&lt;/LI-CODE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Thanks again for helping me out here.&lt;/P&gt;</description>
      <pubDate>Tue, 22 Jul 2025 12:31:22 GMT</pubDate>
      <guid>https://www.servicenow.com/community/developer-forum/get-value-of-attachment-from-record-producer-in-record-producer/m-p/3330613#M1217482</guid>
      <dc:creator>Utpal Dutta</dc:creator>
      <dc:date>2025-07-22T12:31:22Z</dc:date>
    </item>
    <item>
      <title>Re: Get value of attachment from Record producer in record producer script</title>
      <link>https://www.servicenow.com/community/developer-forum/get-value-of-attachment-from-record-producer-in-record-producer/m-p/3330693#M1217505</link>
      <description>&lt;P&gt;&lt;a href="https://www.servicenow.com/community/user/viewprofilepage/user-id/270394"&gt;@Utpal Dutta&lt;/a&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;You didn't share your business requirement though.&lt;/P&gt;
&lt;P&gt;If my response helped please mark it correct and close the thread so that it benefits future readers.&lt;/P&gt;</description>
      <pubDate>Tue, 22 Jul 2025 13:23:33 GMT</pubDate>
      <guid>https://www.servicenow.com/community/developer-forum/get-value-of-attachment-from-record-producer-in-record-producer/m-p/3330693#M1217505</guid>
      <dc:creator>Ankur Bawiskar</dc:creator>
      <dc:date>2025-07-22T13:23:33Z</dc:date>
    </item>
    <item>
      <title>Re: Get value of attachment from Record producer in record producer script</title>
      <link>https://www.servicenow.com/community/developer-forum/get-value-of-attachment-from-record-producer-in-record-producer/m-p/3331676#M1217669</link>
      <description>&lt;P&gt;Hey Ankur,&lt;/P&gt;&lt;P&gt;Sorry couldn't reply you earlier. It is related to a requirement for which I already posted a community question . &lt;A href="https://www.servicenow.com/community/developer-forum/create-multiple-ritms-under-one-request-using-mrvs-on-cataog/td-p/3320917" target="_self"&gt;You can find it here&lt;/A&gt;.&lt;/P&gt;&lt;P&gt;Basically we don't need record producer to insert a record in table. We are creating a request with RITMs using cart with this record producer.&lt;/P&gt;&lt;P&gt;I wanted to capture attachment which is added to record producer and populate it in Request which Record producer has created.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I hope it helps in understanding the requirement.&lt;/P&gt;</description>
      <pubDate>Wed, 23 Jul 2025 08:53:19 GMT</pubDate>
      <guid>https://www.servicenow.com/community/developer-forum/get-value-of-attachment-from-record-producer-in-record-producer/m-p/3331676#M1217669</guid>
      <dc:creator>Utpal Dutta</dc:creator>
      <dc:date>2025-07-23T08:53:19Z</dc:date>
    </item>
  </channel>
</rss>

