[SalesForce] Approval lock/unlock with APEX

I am in Winter '16 and trying to unlock and lock a record in APEX and I am getting the following exception

FATAL_ERROR System.UnexpectedException: Apex approval lock/unlock api preference not enabled.

Does anyone know what is the problem?

Best Answer

You need to go to

Setup->Create-> Workflows and Approvals -> Process Automation Settings

and set checkbox Enable record locking and unlocking in Apex as true

enter image description here More information here.