Purchasing Configurator?

Does anyone here use a purchasing configurator? I was asked if I could make a configurator that generates a different description for the sales order and for the purchase order, as well as setting the part class and purchase notes. I was able to make a configurator that set the purchasing details if configured on the purchase order, but it didn’t work if it was connected to a sales order/quote…

perhaps @asalvatore has done this?

Are you using Document Rules to change the purchasing details? You should be able to add similar / same document rules, just referencing the OrderDtl context instead of PO.

I did, and I even had it output the target entity in a message box to make sure, but even when reconfigurating, if the part was configured first on a sales order it wouldn’t add the purchasing details. I was quite confused. I think its because buy to order forces the PO to look at the sales order for details, and the sales order isn’t changing.

Yeah I just did a quick test on this, doesn’t look like its letting me update any fields on the PODetail. Couldn’t even set the PODetail.TextComment. I’m going to keep messing with this to see if I can’t figure out why it’s locking those fields.

1 Like

Where are you setting the message box? I’m thinking it might not be catching the PODetail Context Entity at all in the document rules. I added a StreamWriter to create a text file in my PODetail DocRule and it isn’t creating the file as expected.

I think I put it in the Save event, not actually in the rules themselves.

I think I’ve got it working! So I added a bit of code to create a simple text file if the Context.Entity == “PODetail” in the document rules. My file wasn’t being generated. Then I added the same bit to the OrderDtl, and that worked, even when I was configuring from the PO Entry screen. So the document rule tied to the PODetail context was never executing it’s DocRule Actions.

Solution I found is a bit… hacky, but it works.

  1. Create a checkbox input (invisible) named something like “POSave” in your Configurator Designer.

  2. Set the value of the new CheckBox Input to true when you’re saving a configuration from the PO Entry screen (Context.Entity will be equal to “PODetail” on the client side). I did this by adding the below line to the “OnPageLeave” expression of the last page of my Configurator:

    Inputs.POSave.Value = Context.Entity == "PODetail";

  3. Finally, I used LINQ to access the PODetail row for the linked Buy-to-Order Order Line, and set the value to wht I wanted: In your OrderDtl Document Rule, add the below to an existing (or new) Rule Action:

if ( Inputs.POSave.Value )
	var pd = Db.PODetail.Where( x => 
							x.BTOOrderNum == Context.OrderNumber && 
							x.BTOOrderLine == Context.OrderLineNumber )

	if ( pd != null )
		pd.LineDesc = "Purchase Line Desc";



1 Like

Did you try setting PO detail properties directly in the sales order rules?

I was hoping for a solution that wouldn’t require re-configuring, if possible. Perhaps I can trigger the correct rules via a bpm or something…

Desired flow would be:

Rep quotes customer outsourced parts

  • Configurator generates a sales description which states what machine the parts are for
  • Configurator generates a description for the mfg. that gives some sizing details but omits what machine it is.

Customer decides to buy, configured lines are pulled into a sales order, and a PO is made for buy direct lines

  • PO detail description would pull in the mfg description and purchase comments without re configuring.

Still you seem to have found the root of the problem which gives me ideas for workarounds to try

1 Like


Nope, didn’t even try. I know you can set fields from other contexts, as I’ve set some OrderHed fields from the OrderDtl DocRule before.

Is the PO creation automatically triggered when the Sales Order is created from the Quote? I do something similar (just with Sales Orders) using an in-transaction Data Directive on the OrderDtl table. You could probably do something similar with the PODetail table and avoid the reconfiguration.

foreach ( var pd in ttPODetail.Where(x => x.RowMod == "A" && x.BTOOrderNum > 0 && x.BTOOrderLine > 0) )
    string thisPartNum = Db.OrderDtl.FirstOrDefault(x => x.OrderNum == pd.BTOOrderNum && x.OrderLine == pd.BTOOrderLine).PartNum;

    if ( thisPartNum == "PartX" ) pd.LineDesc = "PODescX";

If there are several parts where you need alternate descriptions, you could make a UDCodeType and lookup the PO Description based on the PartNum, or if there are only a few that won’t change, just throw them in a Dictionary<string,string> with PartNum and LineDesc.