I am looking for detailed instructions on how to create a BPM or Data Directive to alert the entry person when they enter a duplicate PO#. I want them to move forward with their sales order entry, but they need to be aware that an existing PO# exists.
Does anyone have a BPM or data directive that they can attach or show instructions on how to create one?
Please note… on the customer maintenance screen three is a button to check for duplicates, but it is a hard stop and won’t let an order be created. We checked this box and order entry users can’t add a sales order! Our sales team just needs to know if a PO# exists.
I have read through the other posts, but it seems incomplete or not showing all the necessary steps.
For one, adding “tt” tables to a BAQ - how would I go about doing that?
Update: I miunderstood the first time, so you are entering the PO in your system which means it is actually an SO in your system. For that the table will change. I have revised the code. Sorry for the confusion.
Try adding the CustomCode block and then this code inside it.
I did not include the messagebox code since that in my opinion is a separate question. Also note that just the similar PO# in my opinion is not a good criteria so I added custnum as well, feel free to remove it:
string company ="";
int PONum = 0;
int CustNum = 0;
if(ttOrderHed.Any())
{
foreach(var ttOrderHedrow in ttOrderHed)
{
company = (ttOrderHedrow.Company).toString();
PONum = ttOrderHedrow.PONum;
CustNum = ttOrderHedrow.CustNum;
foreach (var OrderHedRow in (from OrderHed_Row in Db.OrderHedHeader
where OrderHed_Row.Company == company && OrderHed_Row.PoNum == PONum && OrderHed_Row.CustNum == CustNum
select OrderHed_Row))
{
//Your code for action goes here (could be an email, a messagebox, ...)
}
}
}
For messagebox give this a try:
string body = "Your Message Here";
this.PublishInfoMessage(body, Ice.Common.BusinessObjectMessageType.Information, Ice.Bpm.InfoMessageDisplayMode.Individual, "FirstVar","SecondVar");
I got this code from this topic, thanks to @Aaron_Moreng :
@aarong - Thanks, Aaron. This is what I went with first but it doesn’t check for duplicate PO numbers… rather, it disallows entering duplicate PO numbers on the sales order. I am unable to enter any duplicate PO#'s at all. It’s a hard stop.
@ckoch - I will try your code today. I was away for the Thanksgiving holidays and couldn’t respond back to your tip. Appreciate your quick response. I will give this a go.
@Shizar115 - Cool, thanks… I saw this one too but it wasn’t making sense to me. I will give this one a try, as well and see which one works best and let ya’ll know or if I need further assistance in creating my data directive.
@ckoch - I copied your code and the data directive works!!! Thanks so much for your help on this. Thank you so much!
I initially used your method and the first couple of weeks I have had no issue, after that it is throwing three pop-up messages that the PO exists, yet the PO doesn’t exist anywhere.
It prevents a sales order from being created with same PO Number, correct. However, in our case, there will be times when we DO want to duplicate a PO.
We need something that will come up with a message box listing the SO’s with the same PO#
One of the data directives that I have tried worked when I set it up, but then stopped working.