In the Check for Duplicate Document pre-processing action, Trading Networks offers options to check based on Document ID, sender, receiver, or document type. If you want to check based on other attributes, you can use a custom service. Create the service using the wm.tn.rec: DupCheckService specification.
Thanks for your reply! We are using build in service to check the duplicate document based on document id, but the built in service is not exiting from the flow if the document id duplicate. It was executed all the steps and the message was delivered to the partner twice. I think the build in service should throw an error and exit from the flow… But this is not happening…
Indeed it will not throw an exception. Neither will validation. In other words, if you have validation turned on for a document type in TN and an invalid document comes in, TN will add the error to the bizdoc but it will still hand it to the processing rule service. This allows you to take specific action for these errors.
I have a service I created called exitOnError which I typically call in the beginning of my processing rule services. In a nutshell, this service does the following:
If document is not being reprocessed then:
– Call wm.tn.doc:getEvents with errorsOnly set to true
– If the errorCount comes back > 0 then
---- Build an error message
---- Throw an exception to abort processing