Solved

Business event trigger condition using a GI aggregate count value.

  • 11 October 2022
  • 6 replies
  • 297 views

Userlevel 2

I am creating a business event using a GI that returns a count of records in the SOOrder.CustomerOrderNbr field.  We use the GI to search for duplicate values in that field and the GI has a ‘count’ field in the results. 

The business event needs to trigger when that count value is greater than or equal to 2.  I have not been successful with returning the correct values.  It sends each new record inserted instead of following all the conditions. My conditions (Operations) are where there is a Record Inserted and the Count of the customer order # field is >= 2.  It seems to be ignoring the count condition.  I am new to this so very well may be missing something.  

Your insight and help is much appreciated.  Thanks!  

 

 

icon

Best answer by DConcannon 12 October 2022, 04:51

View original

6 replies

Userlevel 7
Badge +4

Hi @scottjohnsonhere! 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.

Alternatively, you adjust the GI to join in the SOOrder table a second time and then only show in the results instances where there is a discrepancy between the records (with the duplicate value being created later, you can join on CreatedDateTime >(Is Greater Than) CreatedDateTime.

I typically recommend to make the GI as simple as possible when it comes to what is coming into the GI and if you can adjust the joins or conditions so that ONLY the duplicated values will populate it might make the BE run better.

Userlevel 2

Thank you for your quick reply @BenjaminCrisman!  My first thought was to use a GI condition where the count in my aggregate field is >=2, but I do not see a method in conditions that would allow this.  (like a ‘having’ clause in sql). I’m delving into your alternative suggestion now.  

Userlevel 6
Badge +2

Hi @scottjohnsonhere,

If I understand the issue correctly, another alternative is to trigger on old and new value in your aggregate field. It sounds like you are grouping the GI on SOOrder.CustomerOrderNbr so if the Customer Order Number is used a second time, it is not creating a new record in the GI output, just an incremented value in the aggregate field (?). Hope this helps.

Userlevel 2

Hello @DConcannon 

Thanks for the reply.  Yes, that is basically it.  I will give your suggestion a try.  

 

Userlevel 6
Badge +2

Hi @scottjohnsonhere,

One other thing to note, be sure to have the aggregate function Count in your GI on a field that will contain unique values. The aggregate function Count is really a Count-Unique. As an example, Group by SOOrder.CustomerOrderNbr and Count SOOrder.OrderNbr. With this setup you can remove the $Count in your BE and trigger on New Value > 1.

Userlevel 2
Badge

Hey @scottjohnsonhere,

Curious, did you ever get this to work?  I have a situation where I would like to trigger a business event from a change on an aggregate value, but I came across this post that indicated that grouping is not supported in GIs used to trigger business events.

https://community.acumatica.com/maintenance-and-troubleshooting-15/troubleshooting-business-events-244

Thank you!

Reply


About Acumatica ERP system
Acumatica Cloud ERP provides the best business management solution for transforming your company to thrive in the new digital economy. Built on a future-proof platform with open architecture for rapid integrations, scalability, and ease of use, Acumatica delivers unparalleled value to small and midmarket organizations. Connected Business. Delivered.
© 2008 — 2024  Acumatica, Inc. All rights reserved