<?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: Coping an attachment from RITM to Data source in Developer forum</title>
    <link>https://www.servicenow.com/community/developer-forum/coping-an-attachment-from-ritm-to-data-source/m-p/2092413#M749339</link>
    <description>&lt;P&gt;Hi Kiran ,&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Any suggestions ?&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Regards,&lt;/P&gt;
&lt;P&gt;Kumar&lt;/P&gt;</description>
    <pubDate>Fri, 29 Jun 2018 04:38:15 GMT</pubDate>
    <dc:creator>kumar86</dc:creator>
    <dc:date>2018-06-29T04:38:15Z</dc:date>
    <item>
      <title>Coping an attachment from RITM to Data source</title>
      <link>https://www.servicenow.com/community/developer-forum/coping-an-attachment-from-ritm-to-data-source/m-p/2092407#M749333</link>
      <description>&lt;P&gt;Hi Folks ,&lt;/P&gt;
&lt;P&gt;I have a requirement like ----&amp;gt; When a user uploads attachment from catalog form with asset details . I have fetch the data and add the information to asset table . I followed below steps&lt;/P&gt;
&lt;P&gt;1. Create a data source for that attachment --&amp;gt; Created a data source&amp;nbsp;&lt;/P&gt;
&lt;P&gt;2. Load data using related link --&amp;gt; 1st time i loaded data manually&amp;nbsp;&lt;/P&gt;
&lt;P&gt;3. Create Transform map and field mappings. --&amp;gt; Done with transform map and field mappings&amp;nbsp;&lt;/P&gt;
&lt;P&gt;4. Create a scheduled import of type 'On Demand' --&amp;gt; Created one scheduled import for the data source which we created earlier in step 1 . But the attachment which was uploaded by user via catalog form is not attaching to data source . Below is the BR which I wrote to copy the attachment automatically to data source by using scheduled import&amp;nbsp;.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Table : sys_attachment&lt;/P&gt;
&lt;P&gt;When to run : After insert&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Script :&amp;nbsp;&lt;/P&gt;
&lt;P&gt;(function executeRule(current, previous /*null when async*/) {&lt;/P&gt;
&lt;P&gt;gs.info("===== BR running =====");&lt;BR /&gt; &lt;BR /&gt; var rec = new GlideRecord('scheduled_import_set');&lt;BR /&gt;rec.get('name', 'Scheduled Data Import for this data source');&lt;BR /&gt;SncTriggerSynchronizer.executeNow(rec);&lt;BR /&gt; &lt;BR /&gt; &lt;BR /&gt;})(current, previous);&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Please let me know where exactly I am mistaken , Thanks in advance .&lt;/P&gt;</description>
      <pubDate>Thu, 28 Jun 2018 13:05:31 GMT</pubDate>
      <guid>https://www.servicenow.com/community/developer-forum/coping-an-attachment-from-ritm-to-data-source/m-p/2092407#M749333</guid>
      <dc:creator>kumar86</dc:creator>
      <dc:date>2018-06-28T13:05:31Z</dc:date>
    </item>
    <item>
      <title>Re: Coping an attachment from RITM to Data source</title>
      <link>https://www.servicenow.com/community/developer-forum/coping-an-attachment-from-ritm-to-data-source/m-p/2092408#M749334</link>
      <description>&lt;P&gt;&lt;A href="https://www.servicenow.com/community/community?id=community_question&amp;amp;sys_id=56b747e9db1cdbc01dcaf3231f961984&amp;amp;view_source=searchResult" rel="nofollow"&gt;https://community.servicenow.com/community?id=community_question&amp;amp;sys_id=56b747e9db1cdbc01dcaf3231f961984&amp;amp;view_source=searchResult&lt;/A&gt;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&lt;A href="https://www.servicenow.com/community/community?id=community_question&amp;amp;sys_id=ff550baddbd8dbc01dcaf3231f961941&amp;amp;view_source=searchResult" rel="nofollow"&gt;https://community.servicenow.com/community?id=community_question&amp;amp;sys_id=ff550baddbd8dbc01dcaf3231f961941&amp;amp;view_source=searchResult&lt;/A&gt;&lt;/P&gt;</description>
      <pubDate>Thu, 28 Jun 2018 13:08:54 GMT</pubDate>
      <guid>https://www.servicenow.com/community/developer-forum/coping-an-attachment-from-ritm-to-data-source/m-p/2092408#M749334</guid>
      <dc:creator>Saikiran Gudur1</dc:creator>
      <dc:date>2018-06-28T13:08:54Z</dc:date>
    </item>
    <item>
      <title>Re: Coping an attachment from RITM to Data source</title>
      <link>https://www.servicenow.com/community/developer-forum/coping-an-attachment-from-ritm-to-data-source/m-p/2092409#M749335</link>
      <description>&lt;P&gt;Thanks Saikiran for sharing the info , But I already saw these post but didnt worked for me . &lt;span class="lia-unicode-emoji" title=":disappointed_face:"&gt;😞&lt;/span&gt;&lt;/P&gt;</description>
      <pubDate>Thu, 28 Jun 2018 13:18:45 GMT</pubDate>
      <guid>https://www.servicenow.com/community/developer-forum/coping-an-attachment-from-ritm-to-data-source/m-p/2092409#M749335</guid>
      <dc:creator>kumar86</dc:creator>
      <dc:date>2018-06-28T13:18:45Z</dc:date>
    </item>
    <item>
      <title>Re: Coping an attachment from RITM to Data source</title>
      <link>https://www.servicenow.com/community/developer-forum/coping-an-attachment-from-ritm-to-data-source/m-p/2092410#M749336</link>
      <description>&lt;P&gt;&amp;nbsp;Hi,&lt;/P&gt;
&lt;P&gt;1) Have business rule after insert on RITM table which runs only for that particular CatalogItem.&lt;/P&gt;
&lt;P&gt;2) Have a data source, transform map and field map created as usual. coalesce etc will bepresent&lt;/P&gt;
&lt;P&gt;3) Have scheduled import created with this data source with active= false, run as administratorsince it will be triggered from script. In left nav type Scheduled Imports and create new&lt;/P&gt;
&lt;P&gt;4) in the business rule condition check whether the RITM has attachment then only run the business rule and have following script&lt;BR /&gt;&lt;BR /&gt;&lt;STRONG&gt;Business rule condition:&lt;/STRONG&gt;&lt;/P&gt;
&lt;PRE class="language-javascript"&gt;&lt;CODE&gt;current.hasAttachments()&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;//extra check you can have is whether it is csv or xls based on data source attachment file typeBusiness rule &lt;BR /&gt;&lt;BR /&gt;&lt;STRONG&gt;script:&lt;/STRONG&gt;&lt;/P&gt;
&lt;PRE class="language-javascript"&gt;&lt;CODE&gt;var dataSourceSysId = ''; // sys_id of the data source you created in step 2
var schImp_GR = new GlideRecord('scheduled_import_set');
schImp_GR.addQuery('data_source',dataSourceSysId);
schImp_GR.query();
if(schImp_GR.next()){
gs.executeNow(schImp_GR);
// use this if it is in scoped app //SncTriggerSynchronizer.executeNow(schImp_GR);
// if in non-scope app i.e. global// the above 2 lines will start the import process, etc automatically
}&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;Thanks,&lt;BR /&gt;&lt;STRONG&gt;Saikiran Guduri (NOW)&lt;/STRONG&gt;&lt;BR /&gt;Associate Certificate Engineer | ServiceNow Store Apps&lt;BR /&gt;(Please mark the answer as &lt;STRONG&gt;correct answer/helpful/accept the solution&lt;/STRONG&gt; if it helps)&lt;/P&gt;</description>
      <pubDate>Thu, 28 Jun 2018 13:31:40 GMT</pubDate>
      <guid>https://www.servicenow.com/community/developer-forum/coping-an-attachment-from-ritm-to-data-source/m-p/2092410#M749336</guid>
      <dc:creator>Saikiran Gudur1</dc:creator>
      <dc:date>2018-06-28T13:31:40Z</dc:date>
    </item>
    <item>
      <title>Re: Coping an attachment from RITM to Data source</title>
      <link>https://www.servicenow.com/community/developer-forum/coping-an-attachment-from-ritm-to-data-source/m-p/2092411#M749337</link>
      <description>&lt;P&gt;If you are not developing any scoped app use this :&lt;/P&gt;
&lt;PRE class="language-javascript"&gt;&lt;CODE&gt;gs.executeNow(schImp_GR);&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;in place of&lt;/P&gt;
&lt;PRE class="language-javascript"&gt;&lt;CODE&gt;SncTriggerSynchronizer.executeNow(schImp_GR);&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Thu, 28 Jun 2018 13:34:24 GMT</pubDate>
      <guid>https://www.servicenow.com/community/developer-forum/coping-an-attachment-from-ritm-to-data-source/m-p/2092411#M749337</guid>
      <dc:creator>Saikiran Gudur1</dc:creator>
      <dc:date>2018-06-28T13:34:24Z</dc:date>
    </item>
    <item>
      <title>Re: Coping an attachment from RITM to Data source</title>
      <link>https://www.servicenow.com/community/developer-forum/coping-an-attachment-from-ritm-to-data-source/m-p/2092412#M749338</link>
      <description>&lt;P&gt;Hi Kiran,&lt;/P&gt;
&lt;P&gt;I wrote same logic on RITM table but its not working , I can clearly see the file is falling in RITM table , but I am not able to understand why this attachment is coping to data source . Below is the code that my BR has&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Table : RITM&amp;nbsp;&lt;/P&gt;
&lt;P&gt;When : After Insert&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Script :&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;(function executeRule(current, previous /*null when async*/) {&lt;/P&gt;
&lt;P&gt;var dataSourceSysId = 'c52aee08db03130094649b81ca961974';&lt;BR /&gt;var schImp_GR = new GlideRecord('scheduled_import_set');&lt;BR /&gt;schImp_GR.addQuery('data_source',dataSourceSysId);&lt;BR /&gt;schImp_GR.query();&lt;BR /&gt;if(schImp_GR.next()){&lt;BR /&gt;gs.executeNow(schImp_GR);&lt;BR /&gt;// use this if it is in scoped app &lt;BR /&gt; //SncTriggerSynchronizer.executeNow(schImp_GR);&lt;BR /&gt;// if in non-scope app i.e. global// the above 2 lines will start the import process, etc automatically&lt;BR /&gt;}&lt;BR /&gt; &lt;BR /&gt;})(current, previous);&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Can you please suggest me with correct process , If I am doing wrong.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Thanks for knowledge sharing,&lt;/P&gt;
&lt;P&gt;Dinesh&lt;/P&gt;</description>
      <pubDate>Thu, 28 Jun 2018 13:56:54 GMT</pubDate>
      <guid>https://www.servicenow.com/community/developer-forum/coping-an-attachment-from-ritm-to-data-source/m-p/2092412#M749338</guid>
      <dc:creator>kumar86</dc:creator>
      <dc:date>2018-06-28T13:56:54Z</dc:date>
    </item>
    <item>
      <title>Re: Coping an attachment from RITM to Data source</title>
      <link>https://www.servicenow.com/community/developer-forum/coping-an-attachment-from-ritm-to-data-source/m-p/2092413#M749339</link>
      <description>&lt;P&gt;Hi Kiran ,&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Any suggestions ?&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Regards,&lt;/P&gt;
&lt;P&gt;Kumar&lt;/P&gt;</description>
      <pubDate>Fri, 29 Jun 2018 04:38:15 GMT</pubDate>
      <guid>https://www.servicenow.com/community/developer-forum/coping-an-attachment-from-ritm-to-data-source/m-p/2092413#M749339</guid>
      <dc:creator>kumar86</dc:creator>
      <dc:date>2018-06-29T04:38:15Z</dc:date>
    </item>
  </channel>
</rss>

