I have a button on a form in read mode that tries to turn on Edit mode, change a status value, save the document and close the document. Because of a soft lock, all that happens is the close document. Is there a way to detect the soft lock in formula so I can tell them what is happening? I tried IsDocBeingEdited right after turning EditDocument on, but it doesn’t detect the change.
Subject: RE: Can I detect soft locks?
If you’re using @Command([FileSave]), it has a return value you can test to find out whether the save worked.
Subject: RE: Can I detect soft locks?
Good try, but the FileSave command blows up and won’t give you a return value if you aren’t in Edit mode. I can’t get in Edit mode because of the record lock. Why, in their infinite wisdom, haven’t they given us a way to either turn soft locks off on a database or at least let us detect them?
Subject: RE: Can I detect soft locks?
Speaking as one of those whose wisdom is being impugned, I have to say it’s enough work making it possible to do everything you need to do, without making it possible to do it all in every language. It doesn’t sound like you’ve considered using LotusScript.
However, I think I have a way to solve your problem without having to go to such an extremity. If you will just do @UpdateFormulaContext after the [EditDocument], I believe you will find that @IsDocBeingEdited then correctly reflects your mode.
Furthermore, nothing “blows up” in macro language. Things return an error value if they fail with an error. The message doesn’t appear unless you exit the formula with an error result. You can test the result of the FileSave command with @IsError or @IfErrror to discover whether it “blew up”, and bypass the message display or replace it with your own message.
There’s probably some special field name or form option to exempt a document from locking, but I don’t have time to look that up for you.
Subject: RE: Can I detect soft locks?
The @UpdateFormulaContext did the trick. Thanks a bunch. Sorry about my earlier comments, I was having a bad day. I don’t know much about soft locks, but wish I had a verb like @DocLocks that worked on soft locks. I’m just afraid to switch on hard locks and what ramifications it would have to the many backend agents that process against the database.