Try our conversational search powered by Generative AI!

Setting ChangedBy by code is overwritten by logged in users username?



On purchase we are unpublishing products if there are no items left in stock using this code:

var productClone = product.CreateWritableClone<Product>();
productClone.ChangedBy = "ProductEOL";
productClone.StopPublish = DateTime.Now;
_contentRepository.Service.Save(productClone, SaveAction.Publish, AccessLevel.NoAccess);

The product is unpublished but the ChangedBy is set to the username of the person that purchased the last item, why is that?

We have some other functions like importing that sets ChangedBy and that works just fine. In the sync function there are no logged in user so I guess i might have something to do with that?


Dec 09, 2021 12:48

Very strange. I just checked the code and ChangedBy is only set to the current user if it is null. I don't have a good answer for you however, so you should contact developer support service - there might be something else in your code that changed that 

Dec 16, 2021 9:39

Thanks, I will try this in Foundation and contact the devloper support if it is the same there.

Edited, Dec 16, 2021 21:08

I got curious and did a test:

If I try to set ChangedBy to "MJ" on a product I get the following results:

As anonymous: ChangedBy = "installer"
As logged in user: ChangedBy = logged in username

If I do the same on a CMS page I get

As anonymous: ChangedBy = "MJ"
As logged in user: ChangedBy = logged in username

Dec 21, 2021 7:22

I alse see alot of changed by "installer" in our Commerce instance, don't know where that is coming from.

So this really is something to report. I will send this to Optimizely and have them sort things out.

Thanks Mari for your test.


Dec 21, 2021 8:29

I believe installer is a system convention for "empty" ChangedBy property. 

Dec 21, 2021 11:50

It is reported as COM-14467 if you want to follow up.

Dec 21, 2021 11:52

Now it is a public bug and can be followed here:

Jan 24, 2022 9:23
This topic was created over six months ago and has been resolved. If you have a similar question, please create a new topic and refer to this one.
* You are NOT allowed to include any hyperlinks in the post because your account hasn't associated to your company. User profile should be updated.