class LockService method .getUserLock()

LockService is the Apps Script service.

.getUserLock() is the method name you will see after a dot in your code.

What it does

Returns a lock private to the current user.

Why it's used

  • Prevent one user from double-submitting a long action.
  • Serialize clicks on a process my rows button.

Common errors

  • Forgetting parentheses on getUserLock. Write LockService.getUserLock(), not LockService.getUserLock or getUserLock by itself.
  • Skipping dots between chained calls. Each step needs a dot, like LockService.getUserLock().
  • Adding spaces where they do not belong. Write LockService.getUserLock(), not LockService .getUserLock(), LockService.getUserLock (), or LockService . getUserLock().
  • Wrong capitalization. Use LockService and getUserLock, not lockservice or getuserlock.

Explore

Related methods

Better Sheets tutorials

No tagged tutorials yet. Fetch Apps Script from the harvest table and this page fills automatically.