CustShip.Update

I’m trying to send an email for a certain customer/partnum when “shipped” is checked on the Customer Shipment Entry screen.

On the CustShip.Update pre-processing I check whether ttShipHead.ReadyToInvoice of changed row is = true. If so, I then check for this particular ttShipHead.custnum. If so, I then check for ttShipDtl.partnum. If so, the BPM should fire an email.

Problem, however, is that any time I add the ttShipDtl.PartNum, the email doesn’t fire. If I delete that part and just keep the custnum, I get the email. If I add the partnum, no email.

I’ve tried to add the part number two ways:

  1. “The specified field of the changed row is equal to specified expression”
  2. Number of rows in x query is more than 0.

In both cases, when the ttShipDtl.PartNum is referenced I get no email. I’ve duplicated the query in a BAQ and I get the desired results.

Any ideas of where I should go from here?

The ttShipDtl is likely blank in this BPM since its a header change. You’ll have to look up the ShipDtl records.

Okay, that would make sense. When I did a trace on clicking the “shipped” checkbox, this method is what was fired. Is there another method that I should consider?

No Method is fine just look up the ShipDtl data.,

Ahh… so I should still use the “Number of rows in the designed query…”, but instead of grabbing the ttShipDtl table, grab the actual ShipDtl table.

Hi Adam,

You can run some custom code that can set a variable to true if the PartNum is the same. Then add one more condition to check whether to send the email or not.

The code should look like this:

foreach(var rows in (from row in Db.ShipDtl where
 row.Company == Session.CompanyID && row.PackNum == ttShipHead.PackNum select row)){
    
     if (row.PartNum == "Your PartNum"){
         SendEmail = true;
     }
  
}

You’ll need to create a variable Boolean called SendEmail.

Thanks Ben. For upgrading purposes, I’m trying to stick with the GUI tools as much as possible. The “designed query” feature mentioned above works well.

If I run into an issue where the GUI can’t handle, I’ll check back to this code.

Thanks again.

1 Like