Generate PO Suggestions Process - BPM

Hello,

We are looking to fire a BPM when the Generate PO Suggestions Process is submitted.

Currently we do most of our Purchasing either manually in PO Entry or in Requisition Entry. When Requisitions are dispatched and the PO Suggestions are created in the corresponding SugPODtl table, we have a couple of BPMs that fire that pull along UD Part Information from ReqDtl to SugPODtl.

We recently began testing the Generate Suggestions Process. We want to mirror the BPMs that are fired from Requisition Entry so we can pull along the corresponding UD Part Data when the system generates New PO Suggestions this way. During our testing, the Suggestions are created, but without the data. The BPMs are only tied to Requisition so we expected this.

Does anyone know of a good hook? We have put together a good number of BPMs, but never one from a submitted process. Our first thought was to try an In-Transaction Data Directive on SugPODtl, but we are not sure if this is the best route.

Any ideas or suggestions are much appreciated.
Thanks,
JM

We are not sure if the Data Directive is even an option…
We have an In-Transaction Directive to just show a message when a record is added to SugPODtl
It works fine when we dispatch from Req… the message will show when a new record is made.
But when we Generate PO Suggestions from the submitted process… no message is shown even though records appear in the table.

@jmarenghi I update SugPODtl rows for the current buyerid when the buyer opens the workbench with post processing on POSugg.GetRowsPlant to update the suggestion before the Buyer sees it and then mark the record as processed so it doesn’t update again until a full regen is done.

Hi Greg,

Thanks for the information. I can get a simple informational BPM to fire when search for New PO Suggestions.

Does this basic scenario sound OK:

  1. Create a checkbox in SugPODtl for whether or not the BPM has fired and done its’s job.
  2. The BPM pulls my data and and does my calculations if that checkbox is false.
  3. Updates the checkbox to true so the record will be skipped next time the search is done.

Would we be looping through all the rows for that plant each time BPM fires?
Side question… Does a full regen remove the records from SupPODtl?

Thanks,
JM

Yes that sounds correct.
You should only be looping thru unchecked records each time.
I also add the current buyer to the query so the first one doesn’t calculate for them all. The buyer is in the where clause.
Full regen does clear all suggestions so the process starts again.

foreach (var ttSugPoDtl_iterator in (from ttSugPoDtl_Row in ttSugPoDtl
                                     where string.Compare(Session.CompanyID, ttSugPoDtl_Row.Company, true) == 0 &&
                                     Session.PlantID == ttSugPoDtl_Row.Plant &&
                                     ttSugPoDtl_Row["Date05"] == null &&
                                     whereClauseSugPoDtl.Contains(ttSugPoDtl_Row.BuyerID) &&
                                     string.Compare(ttSugPoDtl_Row.SugType, "M", true) == 0
                                     orderby ttSugPoDtl_Row.PartNum, ttSugPoDtl_Row.OrderByDate
                                     select ttSugPoDtl_Row))

Thanks Greg…

I am going to proceed as you have nicely outlined here.
I appreciated your help.

Thanks,
JM

I have one small addendum to this.
The necessary UD fields on SupPODtl have been created and the data model has been regenerated.
The BPMs have been put together and the Db.SugPODtl table is being updated when the Post GetRowsPlant fires.
We can query the SQL table and see the work and calculations are happening correctly.

When I pull in records from the search window into New Purchase Order Suggestion Entry, the UD data does not show up in bound controls on the form. The data is in the SQL table when queried.
Only when you close and then re-open New Purchase Order Suggestion Entry will the data show up.
Even a refresh in the current window won’t pull the data into the bound controls.
Only a close and re-open of the form.

So things are working well, but this part is a little clunky.
Any ideas on a good solution for this issue?

Thanks,
JM

@jmarenghi Our buyers open their buyers workbench and then use action new PO suggestions to open their suggestions. This brings up only their suggestions with GetRowsPlant.

There is a way with code to reread the dataset from this post, but it is not something I can do yet.