I've tried a few ways to mark a whole set of records, but am not too happy with the outcome. Here's the problem:
A user searches for some records in a "Persons" table, and then calls a script that sends an email message to some other users, this message contains a list with the names of the Persons records in the found set. The script then sets the "Sent" field with the value of the current day in each record, so that we know: This record already has been announced by email on YYYY-MM-DD.
The problem is that one of the records in the found set might be open as an other user is working on it. In this case the Sent field cannot be set, as the record is locked.
I created a record lock test for my script, so that in case a record is locked the script stops and tells the user that he has to make sure that the locked records need to be committed.
The thing is just: I only want to send the email message and set the Sent field if ALL records of the found set are available. So, first when I am sure that ALL records are unlocked I want to send the message and then set the Sent field.
I cannot think of another solution than testing each record if it is locked, if no opening it, and then (if all records of the found set are unlocked), doing the following steps. This seems a little complicated though to me. In particular with a large found set.
Is there a better way of dealing with this issue?
(I currently work with FM 10 and am in the process of migrating my solutions to FM 13.)