Hi,
We are building a flow where certain people should be notified when there is an order that is awaiting approval. When would be the best time to find such orders?
I’m thinking we could either listen to the OrderCreated event and check if it has the tag AwaitOrderApproval, or listen to the event TagAdded and check if the tag was indeed AwaitOrderApproval. Would these work, or should we do it another way?
// Will the order have the tag here, or could we be to quick on it?
_eventBroker.Subscribe<OrderCreated>(x =>
{
if (_taggingService.GetAll<Order>(x.SystemId)?.Contains(OrderTaggingConstants.AwaitOrderApproval) ?? false)
SendOrderApprovalEmail(x.SystemId);
});
// Not sure what the events actually contains here
_eventBroker.Subscribe<TagAdded>(x =>
{
if (x.Item == OrderTaggingConstants.AwaitOrderApproval)
SendOrderApprovalEmail(x.SystemId);
});
I have looked at the order approval flow on docs but I am unsure in which order things happen under the hood.
Litium version: 8.17