Usina BRAdvPL Guide
Sign in
← All topics
FUNCTIONUnder review

SOFTLOCK()

SoftLock(cAlias)

Reserves a record before confirming maintenance.

SOFTLOCK()AdvPL
01 · OVERVIEW

Overview

The official reference describes reserving the positioned record without an update obligation, potentially before RecLock. This lock is outside transaction tracking and standard unlock routines; its owner needs a verified release path. The documented flow uses RecLock followed by MsUnlock but does not clearly cover cancellation or RecLock failure. The community example also omits checking that return, so it is not reproduced as a complete implementation. (Sources: refs. 1–2.)

02 · SYNTAX

Syntax

SoftLock(cAlias)

Parameters

cAlias
CharacterRequired

Open alias with record already positioned.

Return value

Community code uses a Boolean; the consulted official page has no formal return table.

03 · PRACTICAL EXAMPLE

Commented example

#Include "Protheus.ch"

User Function Ed668()
    // Uninvoked block: reservation requires positioning and guaranteed release.
    Local bReserve := {|cAlias| SoftLock(cAlias)}
    ConOut(ValType(bReserve))
Return Nil
Expected result

Creates block B without reserving records or leaving locks. Under review: editorial example neither compiled nor run in Protheus. Check includes, release, RDD and context before testing.

BEST PRACTICES
  • Do not hold locks across interaction or waits without controlled cancellation. Verify error-path release before approval.
  • Under review: editorial example neither compiled nor run in Protheus. Check includes, release, RDD and context before testing.

Related content

REFERENCES
  1. TOTVS. SOFTLOCK. Reserva, controle de transação e liberação. Accessed on 2026-10-28.
  2. Atilio. dan-atilio/AdvPL. Maratona de Exemplos/Exemplo_365_Funcoes_MsUnlock_RecLock_e_SoftLock.prw. Arquivo completo consultado; adaptação editorial. Accessed on 2026-10-28.
Status
Under review
Page created on
Last reviewed on
Original language
Portuguese
Reviewed by
Usina.BR
0 approved comment(s)

Comments

There are no approved comments yet.

Sign in with Google or Microsoft to comment.

Powered by Usina Docs · Alpha