# External Code BMP - Exceptions, Debugging and Config File **Category:** [Epicor ERP 10](https://www.epiusers.help/c/e10/5) **Created:** 2016-11-09 14:45 UTC **Views:** 1686 **Replies:** 4 **URL:** https://www.epiusers.help/t/external-code-bmp-exceptions-debugging-and-config-file/36162 --- ## Post #1 by @DanB Hey!, I'm here again bothering you whit my problems on External Code on BMP. First of all I recommend reading the solution of the post https://epiusers.help/t/e10-bpm-external-code-use-db-and-bpmcontext/36146?u=danb, which can put a little more in Topic about what I'm looking for. I have managed to use an external dll created for the purpose of migrating receptions to an accounting system that has the company, however I find 3 issues (one that is not really so important since I have been raking since I started to try And advance) 1: Exceptions ---------- Within the external Dll I make a minimum series of validations, where I look for the account accounting for the reception and then attempt to look for it again in a table of relationships that I have, however not in all cases I find that association (either within Epicor as same in the external relation, which is in another database in another server), even this may be useful for other cases where you need it in the future. The problem is that if the validation fails I have no way to show an error in epicor (or I have not found it), although throwing an exception I can send the message and read it somehow in epicor, it is not what I'm looking for already That the text of what would be the error is within the detail of the exception shown. What I am looking for is to be able to send certain text (by exception or some other form) and that said text is marked as an error within epicor and I avoid to continue. 2: Debugging --------- This is the problem that is not so important, since I do it in the old fashion, using messages at all times (and then throw an exception with step by step), but if one knows how to do to debug in the visual studio It would be very helpful as it would save a lot of time. I can not install anything on the server machine, I do not have administrator privileges (neither on my pc), so I can not install anything on any of the 2, at least without prior authorization. 3: Config File --------- In order to search for the related accounting account in the other system I have to be able to configure the external database, for example, although I can do it with a variable that would be better if I can get it from an App.Config, Way to use App.Config? I made the test pass it to an appconfig inside my class library and copy that file (compiled one) to the epicor folder of externals, without success. --- ## Post #2 by @josecgomez Exceptions you can handle, simply wrap your code in try catch and then return an exception object back to your call from the BPM something like Inside your TestMethod when there is an error simply throw new Exception("Thing is bad"); and then on the BPM side wrap your call in a try catch and handle it there Debugging you can use Visual Studio Remote Debugger https://msdn.microsoft.com/en-us/library/y7f5zaaa.aspx For config file your best bet is to either send the file into in your method call MyTestMehod(string fileName) and inside your method read the file.... I don't think you can have an app.config for a DLL.... just store your config somewhere in \\NETWORK\ and pass the file in to the method --- ## Post #3 by @DanB [quote="josecgomez.trigemco, post:2, topic:36162, full:true"] Exceptions you can handle, simply wrap your code in try catch and then return an exception object back to your call from the BPM something like Inside your TestMethod when there is an error simply throw new Exception("Thing is bad"); and then on the BPM side wrap your call in a try catch and handle it there Debugging you can use Visual Studio Remote Debugger https://msdn.microsoft.com/en-us/library/y7f5zaaa.aspx3 For config file your best bet is to either send the file into in your method call MyTestMehod(string fileName) and inside your method read the file.... I don't think you can have an app.config for a DLL.... just store your config somewhere in \NETWORK\ and pass the file in to the method [/quote] Exceptions: Work! thanks. Debugging: Need to install and configure firewall, i will pass for now. Config File: I will try later, now i concentrate in finish the case, using a constant. Again u save me! :) --- ## Post #4 by @rbucek if you installed the remote debugger on the server you shouldn't need to configure your firewall. --- ## Post #5 by @DanB And then my boss commit a homicide :P haha. thanks for the answer :) --- **Canonical:** https://www.epiusers.help/t/external-code-bmp-exceptions-debugging-and-config-file/36162 **Original content:** https://www.epiusers.help/t/external-code-bmp-exceptions-debugging-and-config-file/36162