Would I be adding this as a second condition on the BPM? Or add it to the query that is already in use under the first condition?
I donât see the join the the data base table in the screen shots above, but Iâm assuming that you must have them both (tt and database) if you have it working. So you should be able to simply add the criteria on your database table for the date. (working a little blind here, so forgive the assumptions if they are not correct)
Yes, I do link the tt and the database tables, the screenshots are really old. Here is what Iâm working off of now:
Right, so add a criteria like this to your OrderHed table.
I added that under what I already had on the OrderHed table and got a BPM runtime exception during testing. I added a second line on the condition but it is still firing on everything.
Iâm working on setting up a test.
While Iâm doing that, can you set up a message box to return the rows that are being passed? Do you know how to do that?
No, I donât know how to do that. Is that in the trace?
You can grab a message box, then in the message body, right click, and you can do a field or table query. Try a table query, then click on some fields. Then when the message pops up, you can see what data is being passed. It can help troubleshoot tricky criteria.
We have a BPM on salesorder.masterupdate pre-process that executes the following custom code, works great for us.
var ttOrderHedRow = (from ttOrderHed_Row in ttOrderHed
where (ttOrderHed_Row.Added() || ttOrderHed_Row.Updated())
select ttOrderHed_Row).FirstOrDefault();
if (ttOrderHedRow != null)
var OrderHedRow = (from OrderHed_Row in Db.OrderHed
where (OrderHed_Row.Company == ttOrderHedRow.Company && OrderHed_Row.CustNum == ttOrderHedRow.CustNum && OrderHed_Row.PONum == ttOrderHedRow.PONum
&& OrderHed_Row.OrderNum != ttOrderHedRow.OrderNum)
select OrderHed_Row).FirstOrDefault();
if (OrderHedRow != null)
{
this.PublishInfoMessage("WARNING - This PO has already been used on Sales Order " + OrderHedRow.OrderNum,
Ice.Common.BusinessObjectMessageType.Information, Ice.Bpm.InfoMessageDisplayMode.Individual, "SalesOrder", "CloseOrderLine");
}
}
Thank you! I set that up so hopefully I can see whatâs going on
Hey @timshuwy, since your the widget BPM guy., Do you know why adding a date comparison creates an exception when running the BPM? It looks like itâs a problem trying to compare Nullable and non-nullable date fields.
expand to see exception
Server Side Exception
BPM runtime caught an unexpected exception of âNotSupportedExceptionâ type.
See more info in the Inner Exception section of Exception Details.
Exception caught in: Epicor.ServiceModel
Error Detail
Description: BPM runtime caught an unexpected exception of âNotSupportedExceptionâ type.
See more info in the Inner Exception section of Exception Details.
Program: EntityFramework.SqlServer.dll
Method: DateAdd
Original Exception Type: NotSupportedException
Framework Method: <C001_QuerySizeCondition>b__3
Framework Line Number: 0
Framework Column Number: 0
Framework Source: <C001_QuerySizeCondition>b__3 at offset 230 in file:line:column :0:0
Server Trace Stack: at System.Data.Entity.SqlServer.SqlFunctions.DateAdd(String datePartArg, Nullable 1 number, Nullable
1 date)
at Epicor.Customization.Bpm.BO712CA4B426BC4295962284D1172CDE1F.UpdatePreProcessingDirective_datetest_36249CCD361A4F6DA32EFCB5327D227B.<>c__DisplayClass2_0.<C001_QuerySizeCondition>b__3(<>f__AnonymousType1 2 <>h__TransparentIdentifier0) at System.Linq.Enumerable.WhereSelectEnumerableIterator
2.MoveNext()
at System.Linq.Enumerable.d__25 1.MoveNext() at System.Linq.Enumerable.Count[TSource](IEnumerable
1 source)
at Epicor.Customization.Bpm.BO712CA4B426BC4295962284D1172CDE1F.UpdatePreProcessingDirective_datetest_36249CCD361A4F6DA32EFCB5327D227B.C001_QuerySizeCondition()
at Epicor.Customization.Bpm.BO712CA4B426BC4295962284D1172CDE1F.UpdatePreProcessingDirective_datetest_36249CCD361A4F6DA32EFCB5327D227B.ExecuteCore()
at Epicor.Customization.Bpm.DirectiveBase`3.Execute(TParam parameters) in C:_Releases\ICE\ICE3.2.200.13\Source\Server\Internal\Lib\Epicor.Customization.BPM\DirectiveBase.Generic.cs:line 147
well, my first question would by why are you doing this query against the ERP.Orderhed, and not the ttOrderHedâŚ
I am assuming that this is a âFill data by queryâ widget, but I cannot tell from the image. I cannot quite tell what you are doing with this widget⌠but you should be able to do all that work with the tt record that is already in memory.
Itâs a condition query, trying to check for duplicate PO numbers in the past 90 days.
So I think I have a workaround.
Go the variable tab and date a DateTime variable.
Then add a set arguement/variable widget and set the expression as shown. This will give you the date to compare it to.
Then back in your query, you can compare it to the variable instead of trying to calculated it in the query. From my quick non-exhaustive test, it seems to work.
One more thing, You will need to add a criteria to your tt table. RowMod = âAâ or RowMod = âUâ. I think there are some âstateâ rows with no row mod that will mess up your criteria. In the BPM you have to put ââ around your filter values. (you donât have to do that in a BAQ.)
Thank you! I will test that out today!
Thank you for all of your help! I was finally able to test it out and your workaround did the trick. I really appreciate it!