BPM on creation of new row in Erp.Task

I am trying to create a BPM to record the creation of a new row within the Erp.Task table; can anyone tell me what the trigger event needs to look like?
The business scenario is relatively straight forward and so I’ll use Case Entry as an example: When a customer calls with an issue, we create a Case and assign a Task Set to the Case. When the case is saved, the first task is added to the table Erp.Task. When the task is added, I’d like to have an event triggered; the event is generation of an email but it could be almost anything.
Here is what I’ve tried:
DATA DIRECTIVES: Neither the Standard nor In-Transaction conditions are triggered, even though the Conditions–based on what I can see in a BAQ I run prior to and after clicking “Save”–are true. See screenshot. (NOTE: In-Transaction BPM Workflow Designer doesn’t include a widget for email generation.)
METHOD DIRECTIVES: When clicking “Save,” E10 triggers the Method Erp.Task.Update. A Pre-Processing BPM fails because the data row doesn’t exist yet. A PostProcessing BPM fails on the data condition because all the data has been saved, so as far as the BPM is concerned the row is no longer new. It might be possible to replace Epicor’s existing functionality with a Base Processing BPM, but that feels error prone since I don’t know with certainty everything Epicor does when its own code is called.

What you might want to do is pass data from the pre to the post, possibly via the call context.
You can also enable a post processing directive from a pre processing directive.

I do mine in a standard DD code only like below. The same in a condition should work.

foreach (var SalesRep in (from SalesRep_Row in Db.SalesRep
      where Task.SalesRepCode == SalesRep_Row.SalesRepCode && SalesRep_Row.Company == Task.Company &&
      Task.SendAlertCreate == true && Task.RelatedToFile == "HDCase" && Task.Complete == false
      select SalesRep_Row))
1 Like

Something like this should work:

1 Like

I am truly thankful to all three respondents. I finally got the results I want, and with this want to share what I found along the way. I couldn’t get @MLamkin’s suggestion to work but I might have been doing something wrong; she recommended the condition “There is at least one ADDED row in the ttTASK table”; this feels like it should work but I’m thinking the row is added as a part of the base processing rather than either pre-processing or post-processing and hence fails. My hope was to use either Pre-Processing or Post-Processing; I successfully avoided the Base Processing tab.
@klincecum offered the first suggestion that was helpful to me, “Pass data from the pre to the post, possibly via the call context.” I did this with the setter “Set BPM Data Field”, copying the data I needed into callContextBpmData. from ttTaskRow. as seen in the screenshot:

I also discovered the variable ttTaskRow.Complete, which is TRUE if the task is complete. Unless a task set is done, the completion of one task in turn results in the creation of a new row.
On the Post-Processing side, the completed row is written to the database and also contains a column Erp.Task.NextTaskSeq. This column is pulled in via a small piece of C# code. In turn, a condition checks to see if the sequence number is one that needs an email alert. Because I want additional data for that alert, another small piece of C# code is used to populate data from HDCase, from Customer and from Part. Finally, the Send E-mail tool is used to format the data elements and send off the email.
It seems simple in hindsight but for my first BPM, it was a challenge. I also thank @Carson for sample C# code, as well as the tips to use Show Message in development to ensure variables are being populated as expected, and limit the usage of code during testing by adding a condition for user==self.