# BPM That fires when an order is deleted

**URL:** <https://www.epiusers.help/t/bpm-that-fires-when-an-order-is-deleted/46233>\
**Category:** Epicor ERP 10\
**Tags:** bpm\
**Created:** [July 23, 2018, 2:45pm UTC](https://www.epiusers.help/t/bpm-that-fires-when-an-order-is-deleted/46233 "2018-07-23T14:45:08Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![dbaker](https://www.epiusers.help/letter_avatar_proxy/v4/letter/d/53a042/32.png) [@dbaker](https://www.epiusers.help/u/dbaker)\
**Post date:** [July 23, 2018, 2:45pm UTC](https://www.epiusers.help/t/bpm-that-fires-when-an-order-is-deleted/46233/1 "2018-07-23T14:45:08Z")

</div>

Since the stack trace says the Delete button calls the Update method, I would have expected this to work on Update Post Processing:

```
if (ttOrderHed != null)
{
	foreach (var orderHedRow in (from r in ttOrderHed where (r.Company == Session.CompanyID && r.RowMod == "D") select r))
	{
		this.PublishInfoMessage("Deleted", Ice.Common.BusinessObjectMessageType.Information, Ice.Bpm.InfoMessageDisplayMode.Individual, "", "");
	}
}

```

But according to the Trace Log, there are no rows in ttOrderHed at all. I’m not sure how to capture the Delete event. The Stack Trace looks like this:

```
<tracePacket>
  <businessObject>Erp.Proxy.BO.SalesOrderImpl</businessObject>
  <methodName>Update</methodName>
  <parameters>
    <parameter name="ds" type="Erp.BO.SalesOrderDataSet">
      <SalesOrderDataSet xmlns="http://www.epicor.com/Ice/300/BO/SalesOrder/SalesOrder">
        <TaxConnectStatus>
          <Company>US</Company>
          <SysRowID>00000000-0000-0000-0000-000000000000</SysRowID>
          <RowMod>U</RowMod>
        </TaxConnectStatus>
      </SalesOrderDataSet>
    </parameter>
  </parameters>
  <paramDataSetChanges>
    <paramDataSet name="ds" useDataSetNbr="0">
      <deletedRow tableName="OrderHed" rowState="Deleted" rowNum="0" />
      <deletedRow tableName="OrderRepComm" rowState="Deleted" rowNum="0" />
    </paramDataSet>
  </paramDataSetChanges>
</tracePacket>
```

---

<div class="post-metadata">

**Author:** ![Aaron\_Moreng](https://www.epiusers.help/user_avatar/www.epiusers.help/aaron_moreng/32/745_2.png) [@Aaron\_Moreng](https://www.epiusers.help/u/Aaron_Moreng)\
**Post date:** [July 23, 2018, 3:50pm UTC](https://www.epiusers.help/t/bpm-that-fires-when-an-order-is-deleted/46233/2 "2018-07-23T15:50:54Z")

</div>

Have you tried using a data directive to look at the condition to “There is at least one deleted row in the specified table”?

 ![image](https://epiusers.help/uploads/default/original/2X/8/8f5f9ff4475206d5ae9f4fdc8ddb80353dd330a2.png)  
Might give you a better place to start

---

<div class="post-metadata">

**Author:** ![dbaker](https://www.epiusers.help/letter_avatar_proxy/v4/letter/d/53a042/32.png) [@dbaker](https://www.epiusers.help/u/dbaker)\
**Post date:** [July 23, 2018, 5:36pm UTC](https://www.epiusers.help/t/bpm-that-fires-when-an-order-is-deleted/46233/3 "2018-07-23T17:36:10Z")

</div>

Good call Aaron, thanks, that works. I keep forgetting about Data Directives and doing everything in Method Directives.
