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.