[BPM] Pushing Sales Rep into Sales Order

Good Afternoon everyone,

I’m trying to get the Header Sales Rep to be equal to the Quote’s Sales rep when it’s created.
I’ve tried to use a Pre-processor Method and both Data Directive types on Update to try and assign based on a query. I used the tables below for reference:
OrderHed -> OrderDtl -> QuoteHed -> QSalesRP

I’ve had no luck actually getting the information to copy from the QSalesRP to OrderHed.
Does anyone have any suggestions on how to get this to work?

Hi Chris,

We had some question on the functionality here a little while back. We are on 10.1.600, so I’m not sure if same in your version. Anyway, we found that if a “Split” value greater than 0 (100 typical percent for us) was entered on the quote People/Salespersons/Detail tab (screenshot below) then the sales rep/commission came across onto the sales order. Based on this, I think you might want to ensure that you actually need this bpm. Perhaps the system already does what you need when split is completed.

Nancy

1 Like

One other thing to watch out for, I noticed that the Quote will get more than one sales rep (i.e., viewable via list view under People / Salespersons / List tab) if the sold to is different from the ship to, and there are sales reps assigned to both address in the customer master. In cases like this, we told our people to ensure that the value for Split is only assigned to the ship to rep, which is how we pay commission.

@ChrisGergler, @Nancy_Hoyt, I struggled for a long time with several of the things you’re talking about. Take a look at the post below where I shared my solution… you may need to tweak it to fit your exact needs, but hopefully it is helpful.

Regarding the Split % tidbit - Nancy is correct that setting to 100 in Quote will push the correct Salesrep into the Sales Order (I ended up setting Split % inside a Customization in the post I shared).

1 Like

A sales order can be created from a quote either from quote entry or in order entry. I’ll describe the general process from Quote entry.
Create a post process BPM on Quote.CreateOrder.
One of the parameters in CreateOrder is orderNum and it will contain the sales order that was just created.
Determine the rep you want to fill into the order.
Use the sales order business object and do a Get by ID on the new order.
Update the Rep on the sales order and save.

You could update the fields without the business object, but it’s always safer to use the business object and this time probably easier since the business object takes care of the ~ separations for you.

Try this on Post-Processing Erp.Quote.CreateOrder

var OrderHed = (from OrderHed_Row in Db.OrderHed.With(LockHint.UpdLock) where string.Compare(OrderHed_Row.Company, Session.CompanyID, true) == 0 &&
                       OrderHed_Row.OrderNum == orderNum      
                    select OrderHed_Row).FirstOrDefault();
if(OrderHed != null && string.IsNullOrEmpty(OrderHed.SalesRepList))
 {
    var OrderDtl = (from OrderDtl_Row in Db.OrderDtl.With(LockHint.NoLock) where string.Compare(OrderDtl_Row.Company, Session.CompanyID, true) == 0 &&
                       OrderDtl_Row.OrderNum == orderNum  && OrderDtl_Row.QuoteNum != 0     
                    select OrderDtl_Row).FirstOrDefault();
    if(OrderDtl != null)
    {
          var QSalesRP = (from QSalesRP_Row in Db.QSalesRP.With(LockHint.NoLock) where string.Compare(QSalesRP_Row.Company, OrderDtl.Company, true) == 0 &&
                             QSalesRP_Row.QuoteNum == OrderDtl.QuoteNum && QSalesRP_Row.PrimeRep == true
                    select QSalesRP_Row).FirstOrDefault();
          if(QSalesRP != null)
          {
              OrderHed.SalesRepList = QSalesRP.SalesRepCode ;
          }
      }      
}
1 Like

Thank you everyone for the help! I’m going to walk through each of these as needed starting with setting the Commission to 100%!

Will update as things go!

1 Like

This absolutely worked, and setting it automatically is for the Work Force Role Codes

Thank you so much!

1 Like