Skip to main content
Question

Business Events "For Each Record" and "Once for All Records"

  • 13 August 2024
  • 8 replies
  • 104 views

I have setup a BE with a GI so when the appointment closed status,  it will email a notification. It is working fine if the appointment changes to Closed status. However, if after Closed, users Unclose it and Closed it again for multiple time and it will also trigger the BI multiple times. How do I make it to trigger only 1 time? I tried using Once for all records but it is not working. Can anyone explain how do we use Once for All records? and what is the difference with For Each Record? Thank you.

 

Hi @yehchernchan93,

You have to set the Operation as “Record Inserted” in Trigger Conditions tab to send the notification once per record.

Record Inserted Operation in BE

Hope, it helps!


You will need to add a new field to the appointment (bool). On your business event add another subscriber to update this field to Yes/True. Include this field so in your GI and check it is No/False.

This will mean it will get picked up when appointment is closed for first time and the new flag will be set then even if the user reopens the appointment this flag wont get unset so it will never be picked up again.


Hi @yehchernchan93,

You have to set the Operation as “Record Inserted” in Trigger Conditions tab to send the notification once per record.

Record Inserted Operation in BE

Hope, it helps!

I tried Record Inserted but it doesn’t work in this scenario, thanks for helping.


You will need to add a new field to the appointment (bool). On your business event add another subscriber to update this field to Yes/True. Include this field so in your GI and check it is No/False.

This will mean it will get picked up when appointment is closed for first time and the new flag will be set then even if the user reopens the appointment this flag wont get unset so it will never be picked up again.

I think this is gonna work but I need to figure out how to do this. Is the new subscriber to add have to trigger and update the boolean field by import scenario? I’m not really sure how to create a subscriber through import scenario, any guide or sample online that I can refer to? I tried following a Youtube video but that lead to incorrect outcome. Thanks for the great help! 


The Subscriber of Import Scenario will be on the current business event and its function is to update the Appointment records new flag to true. This means your GI wont select this Appointment again once you add the condition on the GI as well.

This might give you some idea on what the Import Scenario would look like (this one opens and reopen appointments but you can remove that and set your field in it. Have a go at it and if you get stuck i will see if i can help

 


Speaking to the Record Inserted operation:

Correct me if I’m wrong, based on trying to use this, I have a feeling this means the record being initially inserted to the database table? 

This would mean the record was inserted on creation (and events can be triggered on that moment), but if it later changed to Closed status, it would then show on your GI, which is new to the GI, but not actually a record insertion to the database at that point in time.

In this case, using Field Changed for an “existing” record would work.
The next step is adding other Trigger Conditions to exclude it firing on repeat changes to Closed.


The Subscriber of Import Scenario will be on the current business event and its function is to update the Appointment records new flag to true. This means your GI wont select this Appointment again once you add the condition on the GI as well.

This might give you some idea on what the Import Scenario would look like (this one opens and reopen appointments but you can remove that and set your field in it. Have a go at it and if you get stuck i will see if i can help

 

Hi dcomerford,

I am stuck with the import scenario as it is slightly different with the usual import scenario I did. This is the screenshot that I have for this import scenario.I kept getting the error that  the subscriber was not processed. The last error was Object reference not set to an instance of an object. Are you able to spot which field need to be amended? I attached my GI and BE as well. Thank you for the great help.

 


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


Reply