Skip to main content
Answer

GI to identify duplicate customer order number and trigger business event

  • December 6, 2023
  • 11 replies
  • 305 views

Forum|alt.badge.img

Does anyone know if it is possible to create a scenario whereby a notification email is sent if an order with a duplicate CustomerOrderNbr is created?

I thought perhaps I could create a GI with aggregated results - grouped by the CustomerOrderNbr field - with an OrderNbr count, but according to this article GIs with Grouping are not supported by Business Events: 

 

Anyone know of a different approach that would solve this?

Best answer by bryanb39

Try this:

Self join SO.SOOrder

CustomerID = CustomerID
CustomerOrderNbr = CustomerOrderNbr
OrderType = OrderType
OrderNbr <> OrderNbr

You may need to tweak it a bit if Order Type doesn’t always match, but you also don’t want to include CMs or RCs.  

This would only return orders that are duplicates with no grouping or aggregation needed. 

To do a self join, add the table again, you can give it an alias, I just called it SOOrder2 in this case.  

 

11 replies

Forum|alt.badge.img+1

Hi Mike,

Have you tried conditioning the GI so that it only shows orders which have a duplicate value?

Then the BE might work better to trigger only off Record Inserted instead of multiple conditions.


Forum|alt.badge.img
  • Author
  • Semi-Pro II
  • December 6, 2023

Hi @MinushaWeerasuriya76 - Do you have any suggestions how to condition a GI to only show orders which have duplicate values in the CustomerOrderNbr field?


Forum|alt.badge.img+1

Hi @mikeho,

Will you be able to provide the XML of the GI so that I can have a look?


Forum|alt.badge.img
  • Author
  • Semi-Pro II
  • December 6, 2023

Hi @MinushaWeerasuriya76 - attached is a copy of the GI in question.

NOTE: In this case I’m checking the CustomerRefNbr field for duplicates.

 


Manikanta Dhulipudi
Captain II
Forum|alt.badge.img+15

hI @mikeho 

Do you want to stop duplicate order with same customer reference or you need just an email.

If you are looking for avoid order with duplicate customer order nbr please set below preference 

 


Forum|alt.badge.img
  • Author
  • Semi-Pro II
  • December 7, 2023

Hi @manikantad18 - an email would be preferable, but it’s good to know that there is the option to prevent duplicate customer order numbers at the order type level.


Manikanta Dhulipudi
Captain II
Forum|alt.badge.img+15

Hi @mikeho 

Seems to it is critical to anaylse the duplicate customer order nbr and trigger an Business events, Use standard functionality or else we need to see other suggestions as well.

Thanks


Chris Hackett
Community Manager
Forum|alt.badge.img
  • Acumatica Community Manager
  • January 9, 2024

Hi @mikeho were you able to find a solution? Thank you!


Forum|alt.badge.img
  • Author
  • Semi-Pro II
  • January 17, 2024

@Chris Hackett - Unfortunately, no, still trying to find a solve for this.


bryanb39
Pro II
Forum|alt.badge.img+6
  • Pro II
  • Answer
  • January 17, 2024

Try this:

Self join SO.SOOrder

CustomerID = CustomerID
CustomerOrderNbr = CustomerOrderNbr
OrderType = OrderType
OrderNbr <> OrderNbr

You may need to tweak it a bit if Order Type doesn’t always match, but you also don’t want to include CMs or RCs.  

This would only return orders that are duplicates with no grouping or aggregation needed. 

To do a self join, add the table again, you can give it an alias, I just called it SOOrder2 in this case.  

 


Forum|alt.badge.img
  • Author
  • Semi-Pro II
  • January 17, 2024

Thank you, @bryanb39! That’s such a simple solution but it works beautifully. I can even add a relation like “SOOrder.orderNbr -- Is Greater Than -- SOOrder2.orderNbr” to exclude the original (non-duplicate) order from the results.