1

After a package is installed in an upper environment, for instance from DEV to QA it retains the lock from a user unknown or a user in the DEV environment that is not on QA and only an Admin can unlock. How can I fix this issue?

2

Lock will be retained when packaging an item as well as when installing an item regardless of locked user's availability in destination Sitecore instance.

You may write a custom pipeline inside item:saved

<event name="item:saved">
  ...
  <handler type="MyNamespace.UserCreatedClass, MyNamespace" method="CustomHandler"/>
  ...
</event>

and unlock items in your pipeline which are locked in package,

namespace MyNamespace
{
    public class UserCreatedClass
    {
        public void CustomHandler(object sender, EventArgs args)
        {
            if (Sitecore.Context.Job.DisplayName.Equals("Install"))
            {
                Item item = Event.ExtractParameter(args, 0) as Item;
                if (item.Locking.IsLocked())
                {
                    item.Locking.Unlock();
                }
            }
        }
    }
}

Note - This pipeline will be executed whenever an item saved directly [ex - in content tree] or indirectly [ex - when installing a package] but the first line of code will check for job name in context and it will execute the code only for package "Install".

| improve this answer | |
0

I found out the reason why and a simple resolution to the issue. In order to fix this issue you should do the following:

  • ALWAYS make sure you remove locks on the items that you are packaging for deployment to another environment. By default, the "locked" file will retain it's "locked" status across environments.

This is problematic if the that user DOES NOT have access to that environment, for instance Staging. Hence, the package was created in QA in a "locked" state, and then installed in a Staging instance, and that developer does not have access to Staging so there is going to have to be an Administrator that will need to "unlock" the items now at this point.

A user with Administrator access CAN unlock the item/s by using the gutter in the Content Editor. You simply right-click in the gutter, click on "Locked Items" and then click on the padlock to unlock the ones in question.

Here is a blog post on how to unlock items in Sitecore: How to unlock an Item in Sitecore

| improve this answer | |

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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