BAQ inside BPM

Hello,
I am attempting to use a pre-process method directive to check Erp.BO.Receipt.Update. My end goal is to stop a receipt when the ds.RcvDtl.OurUnitCost is $0.00. I must do 2 different conditions. The first condition checks the added or changed row for ds.RcvDtl.OurUnitCost = $0.00. This part of my BPM is working. I need to do a second condition check. We have a part class called P004 where the parts are customer supplied and are at $0.00 value. I need to allow these parts to be received.

The second conditional check is where I need assistance. My first step is to find the part class of the part being received. This information is not on the RcvDtl table and I need to check the PODetail table. I am trying to use the BPM Workflow Designer to accomplish my BAQ inside the BPM. I picked Update Table by Query(but I really don’t want to update the table, I just want to figure out what the part class is). Here is the Update Table By Query.





I then created a message and checked the value of RcvDtl.ShortChar01. It is empty. So I know that I am not successful with this update table and I think it is in my setup table mapping.

Trying many different approaches to solve my problem, I read @hkeric.wci solution to BAQ in BPM Code block BAQ in BPM Code Block. I am a beginner for writing C# expressions or code blocks. This is my attempt at writing an Execute Custom Code block.


I have a practice BAQ working and this is the BAQ code:

Can someone tell me the correct approach to achieving my second condition, specifically I need to find the PODetail.ClassID? Once I have the PartClass variable set then I think I can write the condition.
If the C# code is the best choice, can someone help me fix my code?

Thank you very much for the assistance,
Heide Warren

PODetail is an odd the the field is hw.PONUM (all caps)

1 Like

Hello Haso Keric,
Thank you so much. That eliminated all my errors from the C# block. When I use a message block to give me the variable Part Class, it is still blank. I am able to see the variable PONum and POLine but there is nothing for PartClass.


Anymore suggestions?
Gratefully,
Heide Warren

Add the ClassID to another variable then show that variable in the MessageBox.

Example Code:
You can also use your other variables in this expression.

3 Likes

I am sorry but I have not been able to set the variable PartClass.

If you remove the semi-colon that error should go away.

Thank you for responding. I removed the ; and I get a new error message:
‘ReceiptTableset’ does not contain a definition for ‘RcvDtlRow’ and no accessible extension method ‘RcvDtlRow’ accepting a first argument of type ‘ReceiptTableset’ could be found (are you missing a using directive or an assembly reference?)

It looks like compared to Haso’s example you also have an additional “.” in there twice. Replace “ds.RcvDtlRow” with “dsRcvDtlRow”.

Yep or replace the variables with your other 2 variables on the sidebar ponum and poline

1 Like

Thank you so much for all the help, to both Haso Keric and Gage Thompson. Your code has worked. I am currently testing my BPM and plan to roll it out this afternoon.

One more question: What is the best way for me to learn these coding rules, such as when to use Db, ds, ds., include the word “row”, or tt? I would like to keep learning and I do not know the best resource to read to expand my knowledge on these specific topics. The general C# coding that I have been reading has not helped me figure out some of these very important details.

Thank you again for the help.
Heide Warren

Unfortunately (but also fortunately, because you can interact with us!) the best way currently is to search, browse, and read here.

We have started various wiki type projects which are incomplete due to a lack of time for many of us. Hopefully that work will continue.

Sadly, testing showed some issues with my BPM plan. There are 2 separate problems that I must solve.
Problem 1) If the RcvDtl.OurUnitCost = 0 is true and PartClass=P004 is false then I raise an exception and stop the receipt entry. The result is that the parts are then moved to arrived. Is there a way to stop them from even showing arrived?
Problem 2) The factory likes to do mass receipts with many lines. My test had 4 lines on a mass receipt with line 3 expected to fail. My goal is to accept lines 1, 2, and 4 while stopping line 3. With my BPM setup, all the lines were placed in arrived. The BPM was able to identify that it was line 3 that had the issue (based on my message result) but it was not able to receive and save line 1,2, and 4 lines and stop line 3 which was the one rule breaking line.

I am planning to keep reading, run another trace, and testing. I have found this link that might be helpful for my mass receipt issue.Prevent over receipt for mass receipt

I would like to request more assistance with my issue, please.
Thank you,
Heide Warren