BPM to unfirm sales order releases when customer goes on credit hold

,

Hi

I’ve created a simple BPM to unfirm all the sales order releases when the customer goes on credit hold.

Once the customer is on hold, I’ve set the firm release field to false on all rows. When I click on the order release tab, I can see that the firm release checkbox changes to false. So that part seems to work.

The issue I’m having is that when I close the sales order and go back into it, I see the firm release is checked again, even if I click save before closing the sale order.

Is there something I can do to make this work?

thanks.

A lot would depend on when you are setting this. The customer credit hold can be a bit tricky by itself, but it sounds like you are visibly seeing the result you want at least. What method is the BPM attached to?

Hi Marjorie,

It’s attached to the masterupdate. I tried attaching it to the update method initially and got the same results as the masterupdate.

Ok, that’s a new one for me, I’d never seen the MasterUpdate before, but I checked and indeed it’s there. Learn things all the time :slight_smile:

Now I have found that the tt tables only contain records that have actually changed. So I am assuming you are changing an OrderHed field somewhere as well as an OrderRel field? (supposedly, changing the OrderHed flag makes it part of a tt table, so that’s probably a stupid question by me :smiley: )

Because I have dealt with sending emails to people when an Order is taken off credit hold, either directly OR by the Customer taken off credit hold, I’m more used to writing custom code for dealing with it.

I assume you are only dealing with directly putting an Order on Credit Hold, not by having a Customer (and all associated Orders) be put on Credit Hold.

Being a stubborn writer of code, I’d check to see in PreProcessing, if the Order was put on Credit Hold, and set a CallContextBpmData field accordingly. Then in PostProcessing, I’d check that CallContextBpmData field and see if I needed to loop through all the OrderRel records and change the field. I don’t think you can set the value of a field on all the records with a simple Set Field function. Again, I could be wrong. There’s probably a better way, maybe the Update Table By Query function, vs using Custom Code. In fact, maybe that’s all you need to change, is use Update Table By Query instead of Set Field, giving the OrderNum and setting all OrderRel values for FirmRelease to false.

Hi Marjorie,

Thank you for taking the time for giving me a detailed response. I really appreciate it.

I tried doing the update by query function and I get the same results. I think what is happening is that the field is marked unfirmed at the same time the “customer is on credit hold” flag show up. It’s not writing the change to the DB. If I manually click on save after that popup window, then nothing happens. If I make a change to another field like the PO field and then click save, then the unfirm release actually updates the DB, and everything works as expected.

Is there anyway to force it to save through the BPM?

unfirming the release won’t remove the demand unless you remove the demand from parttran table as well.

I am trying to do the exact same thing. no luck yet.
The tt table only holds the OrderHed information - the OrderRel table is blank.

I am not a “Coder” so i am trying to use Widgets.
If anyone has slayed this dragon i would be grateful.

DaveO

Hi Dave,

I managed to get this to work. I created an In-Transaction data directive on the OrderHed table, with the following conditions.

This is the custom code I used:

var tt = ttOrderHed.FirstOrDefault(r=>r.Added() || r.Updated());
  
// Get the CustomerID
var contactRow = (from contact_Row in Db.Customer where contact_Row.CustNum == tt.ShipToCustNum select contact_Row).FirstOrDefault();

bool CreditHold = contactRow.CreditHold;
bool CreditOverride = tt.CreditOverride;

if( tt != null )
{
    if (CreditOverride == false)
    {
      if (CreditHold == true) 
      {
        
         foreach (var openRel in Db.OrderRel.Where (x =>   x.Company == tt.Company &&
                  x.OrderNum == tt.OrderNum)) 
            {                                     
               if ((openRel.OpenRelease == true) && (openRel.FirmRelease == true)) 
               {
                    openRel.FirmRelease = false;
                 
                }
              
            }
      
      
         Db.Validate();

      }
   }
}
1 Like