Skip to content


Tech Tuesday: Cancel Map After Maximum Number of Errors

There are not many things that Integration Manager does as well or better than SmartConnect but there is one small little feature that is pretty nice that SmartConnect doesn’t have out of the box. That feature is the ability to quit processing additional records if a certain error threshold has been met. We can add this feature fairly easily with a simple task and a Global Variable. The following instructions should help you when you are testing or having something inherently wrong with a setup and they are not just for GP, this can be for Dynamics CRM,, Dynamics NAV, Xero, Concur, Zendesk, Files, SQL, etc.

1) We need to create a Global Variable to set the Maximum Number of Errors. Go to the Maintenance-Global Variables area inside of SmartConnect


2) Now, add a new Global variable with the name GBL_ERROR_MAX and set the default value to 10 (or whatever threshold you desire).


This will now be the default value that can be used accross all maps but you also have the ability to change that on each map by selecting the Global Variables section of each map and overriding with a map specific value like below:


3) Now we need to add a new task under the Tasks section. This task will be on the Pre-Document area and the type will be a Script task.


4) Copy the following script into the task:

if Convert.ToInt32(GlobalErrorCount) >= GBL_ERROR_MAX then
     ‘If you want to show a message when the maximum number of errors has been
     ‘reached before stopping the map processing, uncomment the line below:
     ‘MessageBox.Show(“The Map processing was cancelled after ” & GlobalErrorCount & ” errors.”)
     return false
     return true
end if

Make sure that the On Fail section has been changed to Cancel processing. If you would like to have a message pop up telling you that the map has stopped processing because it has reached your maximum number of errors then you can uncomment the ‘MessageBox.Show line and change any wording that you want.

It should look like this when you are done:


5) Run the Map! It will now show that is has stopped processing after reaching the maximum amount of errors. In the example below I have set the max errors to 2 and also enable the Message telling me that is has quit because of reaching the max amount of errors that was set.


I think you will see how useful and easy to implement on each map going forward. The really nice thing is that you are not limited to Dynamics GP maps with the functionality. It can be used accross the spectrum of our destinations from File, SQL, CRM system and Web Services.


Leave a Comment


Meet the eOne Team at BC Tech Days 2023
Tech Tuesday: Building My First Matrix Report
Overcoming the Top Challenges of Zendesk Integration
Accessing Historical Dynamics GP Data in NetSuite: Using Popdock
Popdock's Top 10 New Features


2016 SmartConnect Integration Bootcamps
Tech Tues: Automatically refreshing Pivot Tables in Excel Refreshable Reports
Happy Thanksgiving from the eOne team!
2017 SmartConnect Integration Bootcamps
New Releases of Extender and SmartList Builder



Business Central CRM D365 Business Central Dynamics 365 dynamics crm Dynamics GP Dynamics NAV Econnect Employee Spotlight eone eOne News error Error Message Events Excel Excel Report Builder Extender Flexicoder GP integration Map Microsoft dynamics crm Microsoft Dynamics GP Navigation List Builder Office Relationships Partner All Hands Call Popdock promotions release SalesForce SmartConnect SmartConnect Bootcamp SmartConnect Maps SmartConnect Office Hours SmartList SmartList Builder SmartPost SmartView SQL Tech Tuesday Templates training Zendesk

Integrate & Automate without Any Code.

SmartList Data has Never Been Faster.

The Easiest Way to Report on GP Data.