I’m trying to do this:
In the QuoteDtl I have 2 fields (for every line) L and H. Now when I create an Order from that Quote (Actions -> Quote -> Create Sales Order), I need that those two field will be transported in the corresponding line (the fields L and H are present in the OrderDtl too).
I created a BAQ that with the OrderNum it will give me the PartNum of every line of the order + the L and H fields of the same Part from the QuoteDtl + the Line (that is the same for the OrderDtl and QuoteDtl. It will serve for finding the correct line in the OrderDtl to put the 2 fields).
Now I need to put those 2 fields in the corresponding line of the Orderdtl but here I am stuck.
I am in BPM “SalesOrder.GetByID” - PostProcessing in which i recall the BAQ
Code of my BPM so far:
Ice.Contracts.DynamicQuerySvcContract boDynamicQuery = Ice.Assemblies.ServiceRenderer.GetService<Ice.Contracts.DynamicQuerySvcContract>(Db);
Ice.Tablesets.QueryExecutionTableset dsQueryExecution = new QueryExecutionTableset();
int numberOfRows = 0;
ExecutionParameterRow drRow = new ExecutionParameterRow();
drRow.ParameterID = "OrderNum"; // name of parameter from BAQ
drRow.ParameterValue = OrderNum.ToString();
drRow.ValueType = "int";
drRow.IsEmpty = false;
drRow.SysRowID = Guid.NewGuid();
drRow.RowMod = "A";
dsQueryExecution.ExecutionParameter.Add(drRow);
DataSet GetFields = boDynamicQuery.ExecuteByID("GetOrderLines", dsQueryExecution);
foreach (var tables in GetFields.Tables[0].Rows)
{
numberOfRows += 1;
}
this.PublishInfoMessage("Number of rows: " + numberOfRows.ToString(), Ice.Common.BusinessObjectMessageType.Information, Ice.Bpm.InfoMessageDisplayMode.Individual, "", "");
for (int i = 0; i <= (numberOfRows-1); i++)
{
this.PublishInfoMessage("PartNum: " + GetFields.Tables[0].Rows[i][0] + "\n L: " + GetFields.Tables[0].Rows[i][1] + "\n L: " + GetFields.Tables[0].Rows[i][2] + "\n Line: " + GetFields.Tables[0].Rows[i][6], Ice.Common.BusinessObjectMessageType.Information, Ice.Bpm.InfoMessageDisplayMode.Individual, "", "");
}
There are two BPMs that need to be written. One for “pushing” a Quote to an Order (when this is done from within Quote Entry). And one for “pulling” a Quote into an Order (when this is done from within Order Entry).
I only need to pull info from the Quote to the Order.
I create the Order from the Quote and the Order is already populated with the lines from the Quote except for those two fields
I found a similar solution the other day that worked for me in a similar scenario (looks like it’s got some extra code you won’t need since you’re using a baq). You should be able to do it pretty easily in a in-trans data directive though on the OrderDtl table (check for added row in if block). Something like the following should work in a data directive, but I haven’t tested it.
So you want the values in each QuoteDtl.L and QuoteDtl.H of the quote to fill the values in OrderDtl.L and OrderDtl.H, when the “Create Order” action is done in Quote Entry?
Not neccessarly when I create the order.
But when I open an Order I want that it (if it’s created by a Quote) search for those two values for every line and match them.
I don’t know if I’m explaining correctly
Does your user need to know when they’ve been changed? Or can it happen silently in the background?
And is it okay if they change on the order ANY time the order line info is fetched? This could cause issues if someone changes L&H on the Quote, and then something like Packer entry fetches those order lines - triggering the check (and possibly updating them)
One more thing… You will actually need a second widget.
What I showed in Post #13 would make the Quote Info show in the Order Entry UI, but wouldn’t actually commit it, unless the order was saved in the UI. To make it autmatically save, add an Invoke BO Method widget to invoke an update method.
It shows me switching between two orders that were made from quotes, and that the Sales Order Comment is blank on both orders
I then enter something in the Job Comment on the quote and save.
I then go back to the Order Entry form, and upon loading an order (tied to that quote line), the Sales Order Comment is updated with the Job comments from the quote.