<?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 Transform Map - reject all records in import if one recored is rejected in Developer forum</title>
    <link>https://www.servicenow.com/community/developer-forum/transform-map-reject-all-records-in-import-if-one-recored-is/m-p/2262767#M913871</link>
    <description>&lt;P&gt;Hi&lt;/P&gt;
&lt;P&gt;Is there a way I can do a pre-check of data from source table before it transforms? then if it finds a record that it will reject due to a choice field being invalid it rejects the whole inport so that the correction can be made and the spreadsheet imported again with corrections?&lt;/P&gt;
&lt;P&gt;Or is there a way to do on-the-fly corrections as and when it finds invalid choices?&lt;/P&gt;
&lt;P&gt;any advise would be appreciated.&lt;/P&gt;</description>
    <pubDate>Mon, 24 Sep 2018 14:56:16 GMT</pubDate>
    <dc:creator>russellprice</dc:creator>
    <dc:date>2018-09-24T14:56:16Z</dc:date>
    <item>
      <title>Transform Map - reject all records in import if one recored is rejected</title>
      <link>https://www.servicenow.com/community/developer-forum/transform-map-reject-all-records-in-import-if-one-recored-is/m-p/2262767#M913871</link>
      <description>&lt;P&gt;Hi&lt;/P&gt;
&lt;P&gt;Is there a way I can do a pre-check of data from source table before it transforms? then if it finds a record that it will reject due to a choice field being invalid it rejects the whole inport so that the correction can be made and the spreadsheet imported again with corrections?&lt;/P&gt;
&lt;P&gt;Or is there a way to do on-the-fly corrections as and when it finds invalid choices?&lt;/P&gt;
&lt;P&gt;any advise would be appreciated.&lt;/P&gt;</description>
      <pubDate>Mon, 24 Sep 2018 14:56:16 GMT</pubDate>
      <guid>https://www.servicenow.com/community/developer-forum/transform-map-reject-all-records-in-import-if-one-recored-is/m-p/2262767#M913871</guid>
      <dc:creator>russellprice</dc:creator>
      <dc:date>2018-09-24T14:56:16Z</dc:date>
    </item>
    <item>
      <title>Re: Transform Map - reject all records in import if one recored is rejected</title>
      <link>https://www.servicenow.com/community/developer-forum/transform-map-reject-all-records-in-import-if-one-recored-is/m-p/2262768#M913872</link>
      <description>&lt;P&gt;Hi,&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;I don't think there is a way to reject the complete records at one go but OOTB, you can set the choice action to reject which will reject the complete row if the invalid choice value is found.&amp;nbsp;&lt;/P&gt;
&lt;P&gt;https://docs.servicenow.com/bundle/london-platform-administration/page/integrate/ldap/task/t_SetChoiceAction.html&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Thanks,&lt;/P&gt;
&lt;P&gt;Pradeep Sharma&lt;/P&gt;</description>
      <pubDate>Mon, 24 Sep 2018 15:32:49 GMT</pubDate>
      <guid>https://www.servicenow.com/community/developer-forum/transform-map-reject-all-records-in-import-if-one-recored-is/m-p/2262768#M913872</guid>
      <dc:creator>Pradeep Sharma</dc:creator>
      <dc:date>2018-09-24T15:32:49Z</dc:date>
    </item>
    <item>
      <title>Re: Transform Map - reject all records in import if one recored is rejected</title>
      <link>https://www.servicenow.com/community/developer-forum/transform-map-reject-all-records-in-import-if-one-recored-is/m-p/2262769#M913873</link>
      <description>&lt;P&gt;Here is my suggested solution:&lt;/P&gt;
&lt;OL&gt;&lt;LI&gt;On your transform map create an "onStart" transform script, in this script you should set a variable such as dataErrors = false, then iterate through the rows in the import set, and if any data issues are found then set the "dataErrors" variable to true, then at the end of the onStart script you can do:&lt;/LI&gt;&lt;/OL&gt;
&lt;PRE class="language-javascript"&gt;&lt;CODE&gt;if(dataError == true){
    ignore = true;
    //optionally you could add something to the log or even send a notification by triggering an event
}&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;This will abort the entire transform process, just take care to iterate only through the current SET, since the import set table may have several days/weeks worth of imports, your script may look similar to this (untested):&lt;/P&gt;
&lt;PRE class="language-javascript"&gt;&lt;CODE&gt;(function runTransformScript(source, map, log, target /*undefined onStart*/ ) {
	
	var dataErrors = false;
	var rowGR = new GlideRecord('myImportSetTable');
	rowGR.addQuery('sys_import_set',source.sys_import_set);
	rowGR.query();
	while(rowGR.next()){
		//run validations on the row
		if(rowIssuesFound){
			dataErrors=true;
		}
	}
	if(dataErrors == true){
		ignore = true;
	}
	
})(source, map, log, target);&lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Mon, 24 Sep 2018 15:35:45 GMT</pubDate>
      <guid>https://www.servicenow.com/community/developer-forum/transform-map-reject-all-records-in-import-if-one-recored-is/m-p/2262769#M913873</guid>
      <dc:creator>David Ramirez</dc:creator>
      <dc:date>2018-09-24T15:35:45Z</dc:date>
    </item>
    <item>
      <title>Re: Transform Map - reject all records in import if one recored is rejected</title>
      <link>https://www.servicenow.com/community/developer-forum/transform-map-reject-all-records-in-import-if-one-recored-is/m-p/2262770#M913874</link>
      <description>&lt;P&gt;This is awesome! Gives me somthing to work with. Thanks&lt;/P&gt;
&lt;P&gt;Is there a way for it to report which errors it found? Maybe in an alert box or somthing?&lt;/P&gt;</description>
      <pubDate>Tue, 25 Sep 2018 07:40:04 GMT</pubDate>
      <guid>https://www.servicenow.com/community/developer-forum/transform-map-reject-all-records-in-import-if-one-recored-is/m-p/2262770#M913874</guid>
      <dc:creator>russellprice</dc:creator>
      <dc:date>2018-09-25T07:40:04Z</dc:date>
    </item>
    <item>
      <title>Re: Transform Map - reject all records in import if one recored is rejected</title>
      <link>https://www.servicenow.com/community/developer-forum/transform-map-reject-all-records-in-import-if-one-recored-is/m-p/2262771#M913875</link>
      <description>&lt;P&gt;Hi,&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;If you are importing data from spread sheet, then you can write DataValidations. So that user can select choices which you have defined in the data validation.&lt;/P&gt;</description>
      <pubDate>Tue, 25 Sep 2018 08:01:53 GMT</pubDate>
      <guid>https://www.servicenow.com/community/developer-forum/transform-map-reject-all-records-in-import-if-one-recored-is/m-p/2262771#M913875</guid>
      <dc:creator>Community Alums</dc:creator>
      <dc:date>2018-09-25T08:01:53Z</dc:date>
    </item>
    <item>
      <title>Re: Transform Map - reject all records in import if one recored is rejected</title>
      <link>https://www.servicenow.com/community/developer-forum/transform-map-reject-all-records-in-import-if-one-recored-is/m-p/2262772#M913876</link>
      <description>&lt;P&gt;Sorry, can you expand on this please? This sounds like exactly what I need but Im very new to scripting so any examples you can provide would be appreciated&lt;/P&gt;</description>
      <pubDate>Tue, 25 Sep 2018 08:18:32 GMT</pubDate>
      <guid>https://www.servicenow.com/community/developer-forum/transform-map-reject-all-records-in-import-if-one-recored-is/m-p/2262772#M913876</guid>
      <dc:creator>russellprice</dc:creator>
      <dc:date>2018-09-25T08:18:32Z</dc:date>
    </item>
  </channel>
</rss>

