Write string data to file from a BPM custom code block


I’m trying to learn how to use C# custom code in a Data Directive BPM. I’d like to start with something simple like logging or displaying a couple fields from a UD table entry that was added. In a C# console application, I would be able to use Console.WriteLine to show some info - how could I do something similar through a BPM? I’m guessing there’s a way to save string information to a file, and then I could go look at that file to see if the directive is triggering even if no useful activity is taking place yet. Thanks in advance for any advice.

There are several things you can do like that.

Here is an easy one:

this.PublishInfoMessage("Your message here!", Ice.Common.BusinessObjectMessageType.Information, Ice.Bpm.InfoMessageDisplayMode.Individual, "", "");

This will popup a message box. (Use wisely)
I use it frequently for debugging, usually filtering it on conditions and whether the Session.UserID is me etc.

This is an easier way to do the same thing. (less formatting options, but for debugging is fine).

InfoMessage.Publish("Your Message");

Welcome Mickey!

Generally, I would say don’t write files on your servers if you can help it. If you’re just debugging, do what @banderson suggested. If you want to write traces, check this out:

How to write your own trace logs - Experts’ Corner - Epicor User Help Forum (epiusers.help)

If you really, really, really want to write files, use the Ice.Lib.ServerPath service to get a reference to a folder within EPICORDATA.

10.2.600 & AR Invoice Form - ERP 10 - Epicor User Help Forum (epiusers.help)

1 Like
1 Like