@IsDocSoftLocked?

Hi,I have an open for approval button on a database.

For various reasons (unexpected behaviour, other post on here), I don’t want to ‘enable document locking’ on the database.

However, I do want to take advantage of ‘soft locking’ feature.

This is currently providing useful functionality which prevents users editing the same document at the same time.

However, it also returns other errors. I would like it to just return the first error (document is already locked by…).

I cannot use @DocLock([STATUS])) as Lotus have introduced another one of those HANDY features, restricting it’s use to database’s where document locking is avaliable. (I don’t want too/can’t implement this).

Additionally, because I want to set an environment variable as the first line of the code, (it MUST be before the edit), I cannot use:

@If(@Command([EditDocument]);

@Do(stuff);

@Return(“”)

Can anyone suggest an alternative that doesn’t involve either enabling document locking for the database, or using the above suggestion.

Here is the actual code in the Open for Approval button:

FIELD OpenforApproval:=OpenforApproval;

@SetEnvironment(“OpenforApproval”;“Yes”);

@Command([EditDocument];“1”);

@Command([ViewRefreshFields]);

@Command([RefreshHideFormulas]);

@Command([RunAgent];“Refresh Document1”);

@If(MainProjectPhase=“Project Inception” & RACIupdate!=“Yes” & RACIStatus!=“Proposal”;

@Do(

@Command( [SectionExpand] );

@Command([FileSave]));

@Command([FileSave]))

Subject: @IsDocSoftLocked?

I wouldn’t think an environment variable would work because it would be placed on each client machine rather than the server.

One idea would be to write specifically to a file on the server, but I don’t think you really want all of your users to have that much access to the file system on the server.

Another would be to create a “lock” document in the database for the document being locked, check for the document’s existence before allowing a change to edit mode and then deleting it when editing is complete. But that would require users to be able to create and delete documents in the database.

If they don’t have delete rights, you could store the UNIDs of documents being edited in a multi-valued field in a document. Then, when editing is complete, you have code remove that UNID from the list.

Hope that helps,

Don

Subject: RE: @IsDocSoftLocked?

Don,Many thanks for your reply.

The environment variable is used for a purpose other than controlling whether documents are locked or not.

For that purpose, it seems to be working fine.

All I really want to do is continue using the ‘soft locking’ feature as now (e.g. this is actually happening already), but instead of it throwing 3 errors (document is locked by xx, command not avaliable, command not avaliable), I just want the code to stop executing after the first error…like @Return does…

Subject: RE: @IsDocSoftLocked?

Can you use @If(@IsDocBeingEdited… after the @Command([EditDocument];“1”) line? If it isn’t being edited, then use a @Return.

Regards,

Don