Ok. I’ve scanned through a ton of posts (some rather funny) about this topic but I can’t seem to put my finger on the answer. Help!!
I need to set the SalesRepCode1 field to always be the Customer.SalesRepCode when a new order is created. Specifically, it doesn’t work properly when converting a quote to an order. I tried method directives, data directives… I tried setting it using custom code, I tried setting it using a widget. I tried the SalesRepList, … what am I missing?
The BPM will fire and update accordingly on an update, but not a new order. I don’t want to do it on an update, though. Only upon initial creation of the order.
This is what I have on a Test system, where I had been fiddling with setting the SalesRep a few weeks ago - hard coded a repcode.
But let me know if it doesn’t work and I can try and check the production system later where I know the final version was working - looking up a rep from customer instead of territory/hard coding. Also I know I added one for quotes at the same time, set rep when converting to an order ( if I remember, on that one I had to use a data directive).
Thanks for the link. I think all we need to do is educate our order entry people that the Split needs to be entered on all quotes… I did notice the behavior I was expecting once I set that split.
My BPM was not setup like that - but I can see why that might work where mine failed. I was trying post-processing and In-transaction directives. And I wasn’t always seeing the SalesRepCode1 available in the widget. I also didn’t consider the Update method because I thought - I don’t want to run this every time someone updates an order. So I was trying to find the right GetOrderHed or similar Method.
But from my reading, it seems like those fields are not actually stored in the table but are created from the SalesRepList field. Might make sense why Post-Processing wasn’t working like I thought.
Yeah, not always obvious what the system is doing. When in doubt, I have gotten in the habit of using simple messageboxes in Pre/Post directives, no conditions. The setup does eats a little extra time but… makes it easy (for me) to see when methods are/aren’t triggered, how tables/fields are populated.
In general when updating the sales order after converting from the quote you need to do the following:
Add a post process BPM.
Use the sales order business object and do a get by ID on the order indicated. (There is a variable that is filled with the new order number)
Update the sales order data set.
Call update on the sales order business object.
Using the business object will make dealing with SalesRepCode1 much easier since it’s in the dataset, but not in the DB.