0

One of our CMS users accidentally clicked the "Approve all" option.

What's the fastest way of either reverting this or grabbing a list of all items that were approved?

We're on 8.1 (160519).

1

1 Answer 1

2

There are various ways to revert the changes. But I would suggest to check Sitecore logs and you will be seeing something similar to this.

10748 10:36:31 INFO AUDIT (sitecore\TestUser): Execute workflow command. Item: master:/sitecore/content/Home/Test Items/Item1, language: en, version: 1, id: {58D1A95E-88D3-4477-ABDF-266C5602BD0E}, command: /sitecore/system/Workflows/Sample Workflow/Awaiting Approval/Approve, previous state: Awaiting Approval, next state: /sitecore/system/Workflows/Sample Workflow/Approved, user: sitecore\TestUser

You can easily identify the items affected by just checking logs.

Or you can just run a search at folder lever based on last updater,

enter image description here

To revert the changes you can do it manually if number of items are less or you can do it with few lines of code.

Change the query based on your scenario. [updated date time and updated by]

 // The below query will return all the items edited by the specific user in a specific time frame
                Item[] items = Sitecore.Data.Database.GetDatabase("master").SelectItems("/sitecore/content/Test//*[(@__Updated >= '20191219T140000Z' and @__Updated <= '20191219T150000Z') and @__Updated by='sitecore\\testuser']");
                foreach (var item in items)
                {
                    using (new Sitecore.SecurityModel.SecurityDisabler())
                    {
                        item.Editing.BeginEdit();
                        item.Fields["__Workflow state"].Value = "Draft/Awaiting approval id";
                        item.Editing.EndEdit();
                    }
            }

You may also write a powershell script to do this.

Note - You may also revert your database to a specific time frame but that won't be a perfect solution, literally you are going back to that specific date, all your recent changes will be lost.

If you are experiencing this in a prod environment, I would recommend you to go through the logs file for the specific date time and find items modified. [you may easily find items id, because logs are pretty clear, unique and you will be seeing user id as well]

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.