BPM When Supplier bank details modified

I have created a BPM process to identify when a supplier bank details has been changed then to email the financial director and make the supplier inactive.
This works perfectly if changing existing bank details. However, If the user is adding bank details for the first time then it is not triggering.

Start of my code is below:
var chg = ds.VendBank.Where(b => b.RowMod == IceRow.ROWSTATE_UPDATED).FirstOrDefault();

if(chg != null)
{
var unchg = ds.VendBank.Where(b => b.RowMod == IceRow.ROWSTATE_UNCHANGED && b.SysRowID == chg.SysRowID).FirstOrDefault();
if(unchg != null && (chg.IBANCode != unchg.IBANCode || chg.BankAcctNumber != unchg.BankAcctNumber || chg.BankBranchCode != unchg.BankBranchCode || chg.BankID != unchg.BankID || chg.NameOnAccount != unchg.NameOnAccount))
{
if( chg.IBANCode != unchg.IBANCode)
{
sb.AppendLine($"IBANCode: [{unchg.IBANCode}] → [{chg.IBANCode}] ");

I tried changing the chg variabe to ROWSTATE_ADDED but this did not trigger anything.
var chg = ds.VendBank.Where(b => b.RowMod == IceRow.ROWSTATE_ADDED).FirstOrDefault();

I tried replace rowstate_updated to “A” as I noticed in the debugger this was A when it was added but this also did not trigger.
var chg = ds.VendBank.Where(b => b.RowMod == “A”;

Any advice please on to get capture when new bank details are added.

Thanks

Not sure exactly what you have in place, what does the trace show when a new one is created? That’s the golden ticket to BPMs. Sometimes we’re just trying to trigger them on the wrong method.

Thank you.
If I click on the plus sign to add it shows as GetNewVendBank

When I enter the details and click Save, it shows as Update.

Essentially your are saying any changes to the Iban number on the vendor bank inactivate the supplier and send and email?

I’d just start with the specific scenario that is not working and start from there.

Create an in trans data directive on the VendBank and monitor if the ibannumber changes from any to another stick a message on the true condition to help you work out the logic.

You can also use the change at the same time to track that change also, as well as calling the post processing directive and send the email.

I think this is one of those situations where using code, just overcomplicates it and we need to take a page from @JasonMcD book of low codedness.

There’s a tidbit in this post below on formatting your code to make it more readable for your helpers.
Tips for asking question on the forum - Experts’ Corner - Epicor User Help Forum

Hope that helps

Hi thanks for your response.
Yes is any changes on IBAN number on vendor Bank then make inactive and send email, which I have working if changing existing bank details, if entering a new IBAN number then its not triggering.
Thanks
Rakhee

1 Like

I have done a similar, however, i used a data directive to monitor when any of the fields in the bank details changed from any to any.

this then marked the supplier as hold payments and emailed the finance department.

1 Like

Thank you, using vendBank and looking for when rowMod=“A” resolved my issue