After a little deeper dive into the code, it seems that following happens:
DefaultContentProvider executes:
ContentReference contentReference = this._contentProviderDatabase.Save(content, action, this._principalAccessor.CurrentName());
where CatalogContentProvider executes:
ContentReference contentReference = this._catalogContentCommitterHandler.Save(content as CatalogContentBase, action, PrincipalInfo.CurrentPrincipal.Identity.Name);
Hi Karol
Try adding this to your code. I believe this is what you want.
writableProduct.ChangedBy = "AutomaticTask";
There is also an content.CreatedBy property, for jobs that create the initial/first version of the content.
It seems to be this bug COM-16450 - i.e. it's known but was not fixed on 14.x
Hi Stefan,
It works, but partially :)
If the product is updated with the ChangedBy modification, then it stays with the same value even if editor changed that product.
Probably due to the bug that Quan mentioned.
FWIW I ping-ed the commerce development team again. they fixed the issues on 13.x and planned to port the fix to 14.x. not sure why that hasn't happened
For some automatic tasks, we would like to know, that the content has been recently modified by the task rather than by an editor user.
To achive this in CMS content one can use IPrincipalAccessor and this works for PageData.
However it does not work for Catalog content (EntryContentBase), and after saving the content, it still uses name of last user.
Package versions:
EPiServer.Framework 12.13.1
EPiServer.CMS 12.17.1
EPiServer.Commerce 14.10.0
Consider following code:
Before running the code, after content has been created by editor:
And after running the code: