Dim record As CaseTrakker.Framework.Script.RecordScriptExtension = Globals.CurrentRecord
Dim recordId As String = record.Value("ct_id").Value
' Load the record (not usually needed if executed on current record)
'record = Globals.CurrentSession.LoadRecord(1, recordId)
Try
' Lock the record
Dim recordLock As CaseTrakker.Framework.Script.RecordLockScriptExtension = Globals.CurrentSession.LockRecord(110, recordId, False)
Try
' Do stuff with the record
Finally
' Make sure we release the lock if we got it
recordLock.ReleaseLock()
End Try
Catch ex As CaseTrakker.Framework.RecordLockFailedException
' Record was locked, so defer
Globals.CurrentWorkflow.DeferActionPendingLock(recordId)
End Try