I’m trying to add some data to a base product when an update occurs.
I’m using the eventbroker to listen to updates like so:
_eventBroker.Subscribe<BaseProductUpdated>(async eventArgs => { await ProductUpdated(eventArgs.Item); });
This is an example for the implementation of ProductUpdated
private async Task ProductUpdated(BaseProduct eventArgsItem)
{
var service = IoC.Resolve<BaseProductService>();
var baseProductClone = eventArgsItem.MakeWritableClone();
baseProductClone.Fields.AddOrUpdateValue("some_field", "some value");
service.Update(baseProductClone);
await Task.CompletedTask;
}
But this would actually trigger the BaseProductUpdated again which will result in a loop. How should I do this to avoid that additional trigger?
Litium version: [7.6.3]