Catch 'ItemCannotBeLockedException' when state=Released

Hi, I'm trying to figure out how and where to catch the Aras.Server.Core.ItemCannotBeLockedException exception so I can display a custom error message to the users.  The executed AML is: <Item type="MyCustomDocument" id="123134234234" action="lock" />. I have implemented "OnBeforeLock()" on my custom ItemType, but this method isn't hit when the ItemType is in Released state. So the question is at which stage in code is the exception thrown and can I sort of catch it or handle it?
  • Any solution on this?? I want to do same thing -> I want to show custom error message when user tries to lock released/not lockable item..

    Thank you!!

  • Hello Aditya, Usually when the Item is in Released state , in the lifecyle you will have state permissions, the warning which you get from System saying that you have insufficient permission etc, If you want to display your error message, Remove state permission for your Lifecycle  Create Custom method for OnBefore UnLock,, get state, if state=Released, display your message

    Thank you