Tech Tuesday: SmartConnect and Task Results
On any task that is added to a SmartConnect map, there is a section where the returned result from the task can be defined. By default, it is set to “Go to next step” for a successful task run and “Quit” for a failure. There is a third option that can be selected though called “Cancel processing” that can also be assigned. Each of these options produce slightly different results based on where the task is being run.
First off, a task will report success if it runs through its actions without encountering an error. A scripting task uses the statement “Return True” to denote that it has been successful. On the flip side, if a task encounters an issue/error or a script executes the statement “Return False” then the task will report a failure.
The “Go to next step” option will always function in the same manner, which basically tells the map to continue what it was doing – either running the next task or document in the process.
The “Quit” option has 2 slightly different results based on what task returns that result. If the task is a pre- or post-map task, then the entire map will stop at that point and report a failure. So if this occurs in the pre-map task the map can be stopped and report an issue before any records are run through.
If a document level task returns the “Quit” result, then that particular document/record that was being processed returns an error – but the map continues running the other records instead of ending at that point. If the pre-document task returns this result, it also stops any data that would have been sent through. If it is a post-document task then the data for that record may have already been submitted successfully since the task doesn’t start until the document has been submitted.
The “Cancel processing” option functions the almost the same as the “Quit” option. The only difference is that the map will not report a failure for that option, it will just end the map or prevent a document from being sent through. That makes the “Cancel processing” option useful when trying to prevent a map or recording from running but a failure event isn’t desired. Any post-map failure tasks would not be triggered by this return result.
The two screenshots below show the difference in what SmartConnect reports when using the “Cancel processing” and “Fail” results at the document level.
The first screenshot shows the “Cancel processing” result, which just prevents one of the records from running through. The “Quit” result returns an actual error, and fires of any post-map failure tasks such as emails.
If you have any questions feel free to leave a comment below or email email@example.com!
Leave a Comment
Integrate & Automate without Any Code.
SmartList Data has Never Been Faster.
The Easiest Way to Report on GP Data.
Chris, is there a mechanism or best practice for canceling a scheduled map when an error occurs?
Not once a map is executing, no. At the start, we can do a Before Map task and cancel the map – but that is our one shot at doing that. At the point of an error, the only way you would be able to stop records from integrating would probably be to filter then out at the mapping Restriction level or using a Before Document script to stop them from being sent.
But you won’t be able to stop the map.
your guy David says I shouldn;t use the ‘Run SQL Command’ as a map task since it is broken and he doesn’t know why. I should use ‘Run SQL script’ as that works. so why do you include ‘Run SQL Command’ as an option if you don;t support it?
There is no “Run SQL script” option – perhaps you mean “Run Script” which is .NET scripting (where you can make your own ADO connections if you wish).
Run SQL Command works fine – lots of people use them. I always do if I can – that way I don’t have to write my connection stuff myself, even if it IS boilerplate.
sorry. I typed script instead of command. thank you for the grammar correction.
that aside. agree to disagree. the ‘Run SQL Command’ task does not behave correctly. I am in the process of converting my ‘Run SQL Command’ tasks to ‘Run Script’ tasks as running as script works and is supported and ‘Run SQL Command’ does not and is not supported. this ‘not supported’ was confirmed by David at SmartConnect.
for the record – I have a sequence of tasks. They all execute their logic correctly. the issue is that is all of the ‘Run SQL Command’ tasks execute successfully and the Map ends reporting failure and stop [processing. David at SmartConnect says to not use their ‘Run SQL Command’ logic.