Code trouble to track deletions from contact Notes field

A

Andrea

Hi all,
The code below works fine on my home stand alone machine with
Outlook2003, but does not work correctly when testing in the office
exchange 2000, Outlook2003 environment. The NotesHighToday and
NotesHighestNumber fields always change to reflect the
NotesFieldCounter value, even though there are if statements to
determine how the fields get updated. It's like the if statements are
not working correctly. How could it work fine at home and not at the
office? I can get the action to run manually. Any ideas?

Thanks!
Andrea Kalli

Function Item_Open()
'count the number of characters in the NotesFieldCounter field upon
record opening
Item.userproperties.find("NotesFieldCounter").value = Len(item.body)

'update the NotesHighToday field upon record opening
item.userproperties.find("NotesHighToday").value =
item.userproperties.find("NotesFieldCounter").value

'update the NotesHighestNumber field upon record opening
if item.userproperties.find("NotesHighestNumber").value <
item.userproperties.find("NotesFieldCounter").value then
item.userproperties.find("NotesHighestNumber").value =
item.userproperties.find("NotesFieldCounter").value
end if

End Function

Function Item_Close()
'count the number of characters in the NotesFieldCounter field upon
record closing
Item.userproperties.find("NotesFieldCounter").value = Len(item.body)

'compare NotesFieldCounter and NotesHighToday field, then trigger
action if NotesFieldCounter is less than NotesHighToday
if item.userproperties.find("NotesFieldCounter").value <
item.userproperties.find("NotesHighToday").value then

'update the NotesDeleteHistory field with user and date information
item.userproperties.find("NotesDeleteHistory").value = Now() & ": "
& application.getnamespace("MAPI").currentuser & vbCrLf &
item.userproperties.find("NotesDeleteHistory").value

'send the user a message because they are deleting characters out of
the notepad
Msgbox "You just deleted something out of the Notepad. A log email
will be sent to the Administrator",0,"DenverMix Notepad Deletion
Message"

'execute custom action
Item.Actions("Notes Field Delete Log").Execute
end if
End Function

Function Item_CustomAction(ByVal Action, ByVal NewItem)

If Action = "Notes Field Delete Log" THEN

Item.Save

NewItem.Recipients.Add("(e-mail address removed);[email protected]")

NewItem.Subject = "NOTES FIELD DELETION NOTIFICATION"

NewItem.Body = "THIS IS AN AUTOMATED LOG EMAIL. PLEASE DO NOT REPLY
TO IT. THIS IS FOR YOUR INFORMATION ONLY" & vbCrLf & vbCrLf &
(application.getnamespace("MAPI").currentuser & " " & "has just
deleted something out of the Database folder Notepad for" & ": Contact
name - " & item.FullName & " / Company name - " & item.CompanyName) &
" on " & Now() & vbcrlf & vbcrlf & "***CURRENT NOTEPAD CONTENTS AFTER
DELETING OCCURED:***" & vbcrlf & item.Body

NewItem.Display


End If

End Function
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top