Data Directive Send Email Formatting

Hi first time poster here. We currently use data directive to send some automated emails daily. The format of these emails makes it pretty hard to read. Is it possible to send the information in a table format with headers? In the example below the headers would be (Resource Desc, Job Num, Part Num, Needs Setup Y/N). I have been attempting to code this my modifying the custom code to format the way I want but I can’t seem to figure it out. I am not receiving any syntax errors and I am not adjusting any of the LINQ portion of the code. When I run the code the data output is blank. Is it possible to code a table format using Data Directives?

ex.
Building 1 Priority 1:

4711 (11) DOOSAN 4500 18" MAX 089411 4900338-01
4504 Okuma M4 123456 V562DV-1
4702 Doosan 2 654132 V562M-5 Needs Setup
4712 (12) DOOSAN 4500 18" MAX 893518 FAB0750105
4710 (10) DOOSAN 4500 18" MAX 561651 4900664-00

What mailer are you using?

Do you have a isBodyHtml property on the object you can set to true, then include HTML tags and format it as html?

sender.IsBodyHtml = true;

EDIT - I was told to welcome you on a banner. Welcome!

Hi
You can create a BAQ that contains the data that you want and then within Custom Code execute it into a temporary dataset then create an HTML email including a table

Currently we have this setup in data directives. Here is a portion of the C# code that generates formats the data currently and then we use the Send Email command.

 if (iRecord.SetupComplete == false)
                                 {
                                    iSetup = "  Needs Setup";
                                  }
                             else
                                {
                                    iSetup = "";
                                }
                         iMess = iRecord.Description + "    " + iRecord.JobNum + "    " /*+ iJoinResults.OprSeq.ToString("G") + "    "*/ + iRecord.PartNum  + iSetup;
                         if (iRecord.SchedComment == "1" && iRecord.URL.Length > 0 && iRecord.URL.Substring(0,1 ) == "1")
                {
                    iB11 = iB11 + Environment.NewLine  + iMess;
                }
                
           if (iRecord.SchedComment == "2" && iRecord.URL.Length > 0 && iRecord.URL.Substring(0, 1) == "1")
                {
                    iB12 = iB12 + Environment.NewLine  + iMess;
                }

Ah, we email out through via a c# code block similar to the examples above. We also have on premise environment which let us install an email server alongside Epicor to handle them. <–(I was not around when the emailer was set up, not sure if you could still C# code and run through Epicor’s built in or not).

AFAIK, the built in emailer doesn’t have any additional settings - however I’ve never dug around in the actual Email method directive, may be able to grab it enroute and reformat it through a bpm there (this is speculation, never dug in before)

We use a Data Directive to send a ship ack email. We load the info by html in C# in the callContextBpmData.Character fields and reference those in the Email Template.
This is a simple table format by placing the html in the callContextBpmData.Character fields inside the C# code.
image

Unfortunately not.

You can however use the built in mailer via code and do pretty much whatever you want, but not from breaking and routing. Gotta do it yourself.

In new UI there is mail template that supports HTML. But it is for Method Directives so far.

2 Likes

@ma.hoffman.Tacony

Hi would you be able to share an example of the html syntax ?

I’m trying to use the email widget in a bpm with html formatting but I just get html like this:

Never been able to get HTML in the email widget to work since it only sends text emails. You can use @klincecum’s function to do it though.

Email Function, with attachments

We have an Execute Custom Code widget where you define the table grid lines with the tracking fields, part number, etc into callContextBpmData character fields.
And here is the Send Email example of html-
Email. Html example.docx (15.4 KB)

I’m doing something similiar (custom code, storing text, and emailing via email widget)

but that doesn’t really look like html, aside from the <_html> tag
is that just a special keyword to tell epicor to internally set the IsHtml flag ?

Oh, I see it now, in your attachment,
it must not have come thru correctly with the email sent from the forum to notify me of your reply

thanks !

That won’t work for me we are using the (new?) email settings for Microsoft Office 365

Anybody walk me through setting that up so I can test?

My networking guy did that here, I can ask him when he comes in if he has a link to some documentation or something…

Sorry, I forgot to get back to you on this,
In case you haven’t found it, here is a nice Epicor help article:

https://erphelp112400.zendesk.com/hc/en-us/articles/24844163957645-Entering-Mail-Settings#Entering3

(Or search “Office 365” in Epicor help and it’s the first article)

image