SGCAdmin
asked on
Lotus Designer - If field is modified, send email
Hi there,
Im trying to create a formula that would send an email anytime a particular field was modified in a form. I would prefer if the email was sent when the save and close button is pushed so if the user changes his mind, the person wouldnt receive the email 2+ times.
Thanks!
Im trying to create a formula that would send an email anytime a particular field was modified in a form. I would prefer if the email was sent when the save and close button is pushed so if the user changes his mind, the person wouldnt receive the email 2+ times.
Thanks!
To clarify:
1 - store field value in a global variable called fldValueOpen in your form's PostOpen event
2 - set global variable isDocSaved to True in the PostSave event (which will obviously occur only after the doc is saved)
3 - in the QueryClose event first check whether the doc was saved
4 - if yes - then we check whether the current field value is different from fldValueOpen (was field value changed)
5 - if yes - send mail
3: we check whether doc was saved because, at QueryClose, field could've been changed (so that fldValueOpen check would return True), but user can choose to discard changes and we don't want to send e-mail in this case.
1 - store field value in a global variable called fldValueOpen in your form's PostOpen event
2 - set global variable isDocSaved to True in the PostSave event (which will obviously occur only after the doc is saved)
3 - in the QueryClose event first check whether the doc was saved
4 - if yes - then we check whether the current field value is different from fldValueOpen (was field value changed)
5 - if yes - send mail
3: we check whether doc was saved because, at QueryClose, field could've been changed (so that fldValueOpen check would return True), but user can choose to discard changes and we don't want to send e-mail in this case.
ASKER
Hi MBonaci,
Thanks for the quick response. I'm not seeing anything on how to use the variable "fldvalueopen". I only have basic design/programming skills, hoping to get a little more detail on this as well as the rest of the steps.
Thanks again :-)
Thanks for the quick response. I'm not seeing anything on how to use the variable "fldvalueopen". I only have basic design/programming skills, hoping to get a little more detail on this as well as the rest of the steps.
Thanks again :-)
OK,
1. Open your form in Designer
2. In the code/form events section Go to Globals > Declarations
3. Place this code there:
1. Open your form in Designer
2. In the code/form events section Go to Globals > Declarations
3. Place this code there:
Dim fldValueOpen As String
Dim isDocSaved As Boolean
4. Go to PostOpen form event and place this code inside the Sub:fldValueOpen = source.document.ReplaceWithYourFieldNameYouWantToTrackChangesFor(0)
5. Go to form's PostSave event and place this code inside the Sub:isDocSaved = True
6. Go To QueryClose event and place this code inside the Sub:If isDocSaved Then
'doc was saved
If source.document.ReplaceWithYourFieldNameYouWantToTrackChangesFor(0) <> fldValueOpen Then
'field is changed
'for demonstration purposes we'll send current document (change this with standard memo if you want)
Call source.document.send(True, "Recipient's e-mail") 'we're sending the form with document (don't do this in production environment)
End If
End If
ASKER
Thats great, works perfectly :-)
The email itself sends the form itself in the body of the email. Is there a way to just send the doc link to the form itself?
Thanks
The email itself sends the form itself in the body of the email. Is there a way to just send the doc link to the form itself?
Thanks
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
ASKER
I get an error "3: Illigal executable code in Declarations"
for this line "Dim s As New NotesSession"
The other Dim lines are just fine
for this line "Dim s As New NotesSession"
The other Dim lines are just fine
That code is supposed to replace the existing code in QueryClose (except first and last line - Sub QueryClose and End Sub)
ASKER
Perfect, thanks very much!
I appreciate the detailed steps :-)
I appreciate the detailed steps :-)
https://www.experts-exchange.com/questions/26801145/Puzzled-on-computed-field-not-refreshing.html
The idea is to check at QueryClose whether the doc was saved.
If yes - the action is performed, which is in your case mail send.
If you need further explanation...