Way of updated a locked field in CRM module through function call?

Way of updated a locked field in CRM module through function call?

Is there a way to update a locked field for an user through a function call? I currently have a function that is being executed through a widget, which is supposed to update a field in a CRM module. When an user cannot manually update the field, the function does not update the field either.