Our management has asked me to configure the system to stop users from being able to send emails (both internally and externally) that leave the subject lines blank… in other words to make the subject line a mandatory field or the user gets an error message and is not allowed to send the mail until they put something in there. Any ideas on how I can do this?
Subject: How to forbid blank subject lines?
In the queryave event of the memo form:
If Source.FieldGetText(“Subject”) = “” Then
Msgbox "You must enter a subject for this memo", 0 + 16, "Error"
Call Source.GotoField("Subject")
Continue = False
End If
Subject: RE: How to forbid blank subject lines?
Actually, if you want to use LotusScript in a form event, it should probably go into the QuerySend event (new in Notes 6). Someone may legitimately wish to save a blank subject as draft or stationery.
Subject: RE: How to forbid blank subject lines?
True, but then you would have the same issue using an input validation formula. Querysend would seem to be the best solution overall.
Subject: RE: How to forbid blank subject lines?
The validation was meant to be the simplest solution, not necessarily the best. I just figured that if we’re elevatin’ the stakes to LS we might as well go whole-hog best practices.
Subject: RE: How to forbid blank subject lines?
Haha. Right on.
Subject: How to forbid blank subject lines?
This will mean making a minor change to the mail template (which will need to be maintained across release versions). The change is minor – but remembering to re-apply it on every upgrade will be necessary.
Open the “Memo” form in the Designer client, and navigate to the “Subject” field. Look for the Input Validation object in the onject browser. Add the following code to the event (in the Programmer’s Pane):
@If(@ThisValue = “”;@Failure(“All e-mail messages must bear a subject.”);@Success)
Similar code can be added to the Reply and Reply With History forms, but the user would actually have had to delete the existing subject in order to create a blank subject.
Subject: one minor modification suggested for this formula
If you don’t want people to get around this by just putting spaces into the subjject, enclose @ThisValue in an @Trim.
@If(@trim(@ThisValue) = “”;@Failure(“All e-mail messages must bear a subject.”);@Success)