Try our conversational search powered by Generative AI!

Incorrect user logged when saving entry in scheduled job

Fixed in

EPiServer.Commerce 13.6.0

(Or a related package)

Created

Jun 28, 2019

Updated

Aug 06, 2019

State

Closed, Fixed and tested


Description

Steps to reproduce:
1. Navigate to Commerce Manager and save a product/variant.
2. Set up a simple scheduled job that updates that entry on a scheduled basis (for example, every 1 minute )

        [ScheduledPlugIn(DisplayName = "ScheduledJobExample", GUID = "d6619008-3e76-4886-b3c7-9a025a0c2603")]
public class UpdateEntryJob : ScheduledJobBase
{
 
public override string Execute()
{
OnStatusChanged(String.Format("Starting execution of {0}", this.GetType()));
 
var contentRepository = ServiceLocation.ServiceLocator.Current.GetInstance<IContentRepository> ();
var referenceConverter = ServiceLocation.ServiceLocator.Current.GetInstance <ReferenceConverter> ();
 
var variantContentLink = referenceConverter.GetContentLink("36127195");
var variant = contentRepository.Get<FashionProduct>(variantContentLink).CreateWritableClone<FashionProduct>();
 
variant.Brand = "test";
 
contentRepository.Save(variant, DataAccess.SaveAction.Publish);
 
return "Done";
}
}

Expected:
The Versions gadget's ChangedBy field value is “Installer” or “System,” to indicate it was changed by Epi and not a user.

Actual:
The Versions gadget ChangedBy field shows that the entry was updated by the person in CatalogContentEx.ModifiedBy field.