BPM Email Alert - Fields Show Twice

I created an POST BPM for an email alert to notify our cost accountant when a mfg-stk transaction has $0 material cost (so she can chase down the outlaws!). :slight_smile:

The BPM seems to fire properly, but the added fields in the email template either get repeated, or don’t show at all.

If I chose “Added Records” and “Updated Records” (like we have on all our other BPM Email Alerts), then I don’t get anything at all. If I have “Unchanged Records” only, then it shows the field twice.

What did I goof up? Thanks guys!

Screen Shots:


or

image

image

Basic BPM details:

image

image

image

Use a Field Query instead of a Table Query

It was a field query - When I click on the Subject line in the Design Email Template, then click the Insert button, table query doesn’t appear as an option. We’re on 10.2.300.12, if that changes anything.

image

I thought maybe copy and pasting the from the subject to the body may have caused it, so I deleted the “inserts” in the subject, and left it in the body. That messed it up even more! I think I’ll delete the widget and start over…

Edit - Tested again, no change… still showed up twice or not at all.

Does it still appear twice when you put the same field in a popup message?

Why are using the “Unchanged”, instead of “Added”?

Usually, when I want to do an email alert that has data, I collect the data in call contexts in a pre, then use those contexts in the post email widget. You could try that and see if that helps.

If I don’t have “Unchanged” checked, then the data fields don’t show up in the email at all.

Darren, it acts the same as the email. If Added and Updated is checked, then nothing. If Unchanged is checked, then double.

Aaron - Thanks. I’ll give that a try. I’d like to learn why my method isn’t working in this case, when we have other BPM’s that are nearly identical and it does show the fields properly (in the pop-up msg or email).

I also put in EpiCare Case # CS0001539477.

Thanks for the ideas, guys!

FWIW - I’ve occasionally seen multiple values(separated by a comma) for a table query during development. I was told this is when the data set has multiple records. Or in some cases, one value was the existing value, and the other was the new value. I don’t recall exactly what I did in those circumstances, but I was able to resolve it rather without doing anything special

I did some testing on the same BO and method and found that I get the same thing as you.

If I change it to a Pre-Proc, and only have the “Updated records” box checked on the table query, I get a single value.

2 Likes

How the added vs unchanged is handled is per BO and a lot of time per call. Some calls esp in the Job area take two records a changed and unchanged record. Other time that is not the case and you just have the changed. It’s seemingly random and likely due to two different camps in Epicor development at different points of time in how dirty rows should be handled. Ever try to use a data directive with “where field changed” and it doesn’t work? That’s one of those cases it needs the old and dirty record and both were not supplied. That can happen with custom code and sometimes even Epicor native doesn’t pass the clean and dirty.

1 Like

Working as designed will be the response.

We’ll see.

I made a Pre-BPM per Calvin’s suggestion, and it worked like a charm. Thanks!

Not quite sure why, but I bet you’re (Josh) onto something. My thinking was that the Post made more sense, since I wanted an alert after the BO did it’s thing and the transaction was final…

Thanks guys!

Sometime you just need a pair that work together. They (Epicor) teach some BPM’s like that in their extended ed. You could wait to fire off the e-mail so in your pre, just save the data, then enable the post and use the same criteria to send it with the post. (But only if your pre-proc solution doesn’t work on it’s own)

1 Like

Since in 10 the Newtonsoft library is available native, sometimes I’ll convert an entire dataset into a serialized string, pass it through Call Context to post process, de-serialize and process from there. I will Log.WriteEntry serialized data too if I want to see more of a dataset for debugging BPMs it works nice.

using(CustShipSvcContract csSvc = Ice.Assemblies.ServiceRenderer.GetService<CustShipSvcContract>(Db))
{
  CustShipTableset csts = new CustShipTableset();
  csSvc.GetByID(ref csts, 85312);
  Ice.Diagnostics.Log.WriteEntry($"{Newtonsoft.Json.JsonConvert.SerializeObject(csts)}");
 
  // Use this URL to format the data back to something readable https://jsonformatter.curiousconcept.com/
}
3 Likes

Cool.