Link to home
Start Free TrialLog in
Avatar of sns-emea
sns-emeaFlag for United Arab Emirates

asked on

How do i stop a mail rule in lotus notes

Hello,

For any employee when he/she is going for vacation, I use to create a RULE from the user database in order to forward the emails to another user till the user is back, but now for some reason even if i disable first and then delete, still its active and running although you don't see the RULE. Earlier I use to create a new rule and then the previous one use to stop but now even the first one is still active. Is there a way to disable it.

Domino version is 8.5.2
Avatar of Getsum_Bloodlust
Getsum_Bloodlust
Flag of Australia image

Convert to Exchange Server
Avatar of sns-emea

ASKER

Sound easy but i have 200(users) clients running lotus notes.
Avatar of Sjef Bosman
> ... I use to create a RULE from the user database...
Meaning: you recently upgraded to R8.5.2? From which earlier release? And which exact release do you run now, which FixPack?
It could be that there are some left-overs from an earlier release...

More info that might be relevant:
http://www-01.ibm.com/support/docview.wss?rs=899&uid=swg21217940

@Getsum_Bloodlust: ROTFLMAO
Got nothing better to do?

Hi
The rules are stored in the calendar profile in hidden fields "$FilterFormula_"
Remove those fields to stop the rules engine even if the rule  documents (in the mailbox) were deleted.
How can I find this hidden field "$FilterFormula_" ?

We upgraded from 6.02 to 8.5.2 to entirely new server but ofcourse same NSF files.
Hi
In the comments section of this article is an example agent
http://itknowledgeexchange.techtarget.com/itanswers/email-still-forwarding-after-forwarding-rule-has-been-deleted/
search for ron jarvis
> How can I find this hidden field "$FilterFormula_" ?
Did you check the link I posted??

Did you upgrade the mail file to the new template? As far as I can tell, the problem should be solved then.
Even after upgrading the template to mail85.ntf still the same, I can see that $FilterFormula_0 still contain the forward rule which was created earlier, How to delete this ? I can view it by using notespeek but cannot edit.
Print "Removing field '" & sFieldName & "' from
Calendar Profile."

This field is in RED... ??
C'mon! You've done some LotusScript before, haven't you? So you should know that a Carriage Return got inserted in the line...

Print "Removing field '" & sFieldName & "' from Calendar Profile."
Seriously this is the very first time i will be working on lotus script.

The agent is save now but now when i right click and run it says "This agent must be run from a view window".
Seriously?? What took you so long? ;-)

Either do what it says, i.e. open a view, click one document (it won't change the document) and run the agent, or set the agent's selection to None (in the Designer, in the Agent's properties)
Well I did it myself by creating a button which clear the calender profile, Its just that the user have to create his signature again and thats it. But is this a bug ? There is no fix for it?
Sub Click(Source As Button) 
      Dim session As New NotesSession 
      Dim db As NotesDatabase 
      Dim doc As NotesDocument 
      Set db=session.CurrentDatabase 
      Set doc=db.GetProfileDocument("CalendarProfile") 
      Call doc.remove(True) 
      If doc Is Nothing Then 
              Msgbox "Profile Document Was Successfully Removed" 
      Else 
              Msgbox "Profile Document WAS NOT Removed",48 
      End If 
      
End Sub

Open in new window

ASKER CERTIFIED SOLUTION
Avatar of Sjef Bosman
Sjef Bosman
Flag of France image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
How can i change the code for this agent into a button so whenever I need to run for a particular user he/she just have to click on it and this will wipe out the rule which doesn't exist in UI but exist in calender profile ??
'(Options)
Option Public
Option Explicit

Sub Initialize
%REM
Author: Ron Jarvis
Purpose: Removes all mail rules contained in caledar profile. Needed to handle 
situations where the rule has been removed from the UI but still exitsts in the 
calendar profile.
%END REM

Dim i As Integer
Dim iDocNeedsSaving As Integer
Dim sFieldName As String

Dim ns As New notessession
Dim ndb As notesdatabase
Dim nd As notesdocument
Dim niTemp As notesitem

Set ndb = ns.currentdatabase
Set nd = ndb.getprofiledocument("CalendarProfile")
Print "Handle on Calendar Profile...."

iDocNeedsSaving = False

'Kill the rules
For i = 0 To 50
sFieldName = "$FilterFormula_" & i
Set niTemp = nd.getFirstItem(sFieldName)
If Not niTemp Is Nothing Then
Print "Removing field '" & sFieldName & "' from 
Calendar Profile."
Call niTemp.Remove
iDocNeedsSaving = True
End If
Next

'Kill the rule counter field
sFieldName = "$FilterFormulaCount"
Set niTemp = nd.getFirstItem(sFieldName)
If Not niTemp Is Nothing Then
Print "Removing field '" & sFieldName & "' from Calendar 
Profile."
Call niTemp.Remove
iDocNeedsSaving = True
End If

If iDocNeedsSaving Then
Call nd.Save(True, False)
Print "All rule information removed from the Calendar Profile."
Else
Print "No rule information found on Calendar Profile."
End If	

End Sub

Open in new window

The code above removes all info regarding Rules from the Preferences as stored in the profile document. The code can run in an agent but also in a button. Where do you want to show the button? In a mail? Create a new mail, and while in the text, click Create/Hotspot/Button. Set it to run LotusScript and paste the code in.
is this better then the code (button) which i mentioned earlier ? the only thing is after clicking it the signature is gone
SOLUTION
Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
Thanks a lot the code did it !!! As i create as a button.