IsLocked

You can use the IsLocked function to determine whether an Optiva object is locked.

When to use

You can use this function to:

  • Check whether an object is locked before attempting to edit or modify the object.
  • Implement custom checkout and checkin logic.

Syntax

int IsLocked(string objSymbol, string objKey);

Parameters

Parameter Type Required Description
objSymbol string Yes

The symbol of the object.

Note: You can use empty quotation marks ("") for the current workflow symbol.
objKey string Yes

The key of the object.

Note: You can use empty quotation marks ("") for the current workflow symbol.

Return Value

The application returns a value one if the object is locked and zero (0) if the object is not locked.

Prerequisites

  • The object must exist and be accessible.
  • The object type must support checkout and checkin functionality.
  • You can override security and change a locked formula using a workflow.

Examples

Example 1
Verify the current object of the workflow is Locked.
int rc = IsLocked();
if (rc == 1)
{
    MessageList(_OBJECTSYMBOL + " " + _OBJECTKEY + " is locked.");
}
else
{
    MessageList(_OBJECTSYMBOL + " " + _OBJECTKEY + " not locked.");
}
Description
This example determines whether the current workflow object is locked.
Example 2
Verify the formula is locked.
int rc = IsLocked("FORMULA", "FS-0010\0001");
if (rc == 1)
{
    MessageList("Formula FS-0010\0001 is currently checked in.");
}
else
{
    MessageList("Formula FS-0010\0001 is currently checked out.");
}
Description
This example determines whether the specified object is locked.