Solved

Lotus Script Agent.  No error but doesn't work

Posted on 2008-06-16
14
1,172 Views
Last Modified: 2013-12-18
Hi All,

I attached a small Lotus sript that should save detachments from mails.
The script shows no error messages but it doesn't work unfortunately.

Could you please tell me what's wrong with it?
Thanks,

Agent.txt
0
Comment
Question by:verto33
  • 6
  • 5
  • 2
  • +1
14 Comments
 
LVL 17

Expert Comment

by:fgrushevsky
ID: 21793617
What does it say in the agent log? check ECL, could it be that agent signer does not have rights to access filesystem?
0
 
LVL 13

Expert Comment

by:CRAK
ID: 21794929
You may need to set the agents privileges (2nd tab, half way) to "2. Allow restricted operations". That will allow reading/writing files to disk.

If it runs scheduled, you'd need privileges for that as well (domino directory, server document, restrictions tab).
0
 

Author Comment

by:verto33
ID: 21802068
The "Set runtime security level" is set to 2
I even tried it with the 3 but no error message and no result.
The laptop user has full access to the D:\Detach folder

It isn't scheduled but Action menu selected.
Do you have any idea what the problem could be?

Where can I find the agent log?
0
Microsoft Certification Exam 74-409

Veeam® is happy to provide the Microsoft community with a study guide prepared by MVP and MCT, Orin Thomas. This guide will take you through each of the exam objectives, helping you to prepare for and pass the examination.

 
LVL 17

Expert Comment

by:fgrushevsky
ID: 21803176
Open database in Designer,  within Designer go to agents , (Shared Code - Agents), highlight your agent, then go to the  "agent" menu and select log there
0
 
LVL 13

Expert Comment

by:CRAK
ID: 21806883
Assuming disk access is ok then (i.e. you can write files to D:\Detach yourself as well) and given the fact that you see no errors, my guess would be that the unprocessed search raises a 0-document collection.

Switch the Lotusscript debugger on to see what happens. The Do while-loop may never execute.
Or add a messagebox to display shipping.count before you trigger that loop.
0
 
LVL 2

Expert Comment

by:FormanJackJ
ID: 21817328
I would add PRINT statements to your code so you can see if it is running and the progress of the agent. If you run this agent at the server. the print will show in the server's console & log database.

I looked your agent, and I added PRINT statements to it.
Agent-Rev2.txt
0
 

Author Comment

by:verto33
ID: 21820949
fgrushevsky:
I attached the agent.log

FormanJackJ:
I attached the code to make ou see that one of the printing line gives an error.
I removed this line but then still no error and no saving.
No screen message appeared

CRAK:
I switched on the lotus debugger but it shows no error

Just to be sure I made everything well.
If I open the Agent in the designer I see following:
Document Selection   --empty
(Options)      -empty
(Declarations)      -empty
Initialize       here is the whole code
Terminate      -empty

print-code.doc
agent-log.doc
0
 
LVL 13

Expert Comment

by:CRAK
ID: 21826346
0.name in that line should be o.name
(ie letter "o" next to p instead of number 0)
0
 
LVL 13

Expert Comment

by:CRAK
ID: 21826388
Debugging shows no error, but doet it enter the while loop, or does it jump from "while" straight to wend on its 1st attempt?

That may happen when no docs meet the search criteria.
0
 

Author Comment

by:verto33
ID: 21845700
The debugger jump from the line
Do While Not shippingDoc Is Nothing

directly to the line
End Sub

If e.g. 2 mails are selected with attachments
0
 
LVL 13

Expert Comment

by:CRAK
ID: 21850029
Ok, that what I expected!
That means that the agent did not get any documents... documentcollection is empty (.count=0)

At this time the collection is based on this line:
Set shipping=db.unprocessedSearch({@Contains(@upperCase(Subject);"SHIPPING")},Nothing,0)

The documents returned (according to designer help) are collected must...:
- be considered "unprocessed" by the current agent
- meet the specified search criteria
- were created or modified since the cutoff date

"Unprocessed" depends on what the agent is set to run on (selected docs, all docs in a view etc). You may want to consult designer help for all details.
The cutoff date is set to Nothing in your code, so we can rule that limitation one out already!

That leaves two things for you to look into:
1) What does the agent run on?
2) Do (some of) the selected documents meet the search criterium (i.e. does the Subject field contain "Shipping" (in any case type).

Do let us know (if you don't know how to check, don't be shy!)
0
 

Author Comment

by:verto33
ID: 21853265
Sorry, it was my fault. I didn't realize that the subject doesn't contain the word "Shipping"

I got this code from a colleague and I didn't check the conditions.

Is there a way to remove this condition with the subject? I tried but got errors every time.
Something like replacing shippingDoc with AllDoc or SelectedDoc?
0
 
LVL 13

Accepted Solution

by:
CRAK earned 100 total points
ID: 21864546
So all you really need is the unprocessed document collection?

Sub Initialize
	Dim session As New NotesSession
	Dim db As NotesDatabase
	Dim coll As NotesDocumentCollection
	Dim doc As NotesDocument
	Dim body As NotesRichTextItem
	Dim rtitem As Variant
	
	Dim directory As String
	Dim attachname As String
	Dim filename As String
	Dim oname As String
	
	directory="D:\Detach\"
	
	Set db = session.CurrentDatabase
	Set coll = db.UnprocessedDocuments
	
	Set doc=coll.GetFirstDocument
	Do While Not doc Is Nothing
		
		Set rtitem = doc.GetFirstItem( "Body" )
		Forall o In rtitem.EmbeddedObjects
			oname=directory + o.name	
			Call o.ExtractFile( oname )	
		End Forall
		
		Set doc = coll.GetNextDocument(doc)  
	Loop
End Sub

Open in new window

0
 

Author Comment

by:verto33
ID: 21874404
Thanks for your help. It works perfect.
0

Featured Post

ScreenConnect 6.0 Free Trial

Explore all the enhancements in one game-changing release, ScreenConnect 6.0, based on partner feedback. New features include a redesigned UI, app configurations and chat acknowledgement to improve customer engagement!

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Suggested Solutions

Title # Comments Views Activity
Compose new document with values from selected doc using LotusScript 36 278
Work Space in Lotus Notes cannot found 6 169
Lotus notes send email with attachments 8 166
@Mailsend 3 58
Notes Document Link used by IBM Notes is a link file which aids in the sharing of links to documents in email and webpages. The posts describe the importance and steps to create a Lotus Notes NDL file in brief.
Article by: Rob
Notes 8.5 Archiving Steps and Tips This article covers setting up a Notes archive, and helps understand some of the menu choices making setting up and maintaining a Notes archive file easier.
This Micro Tutorial hows how you can integrate  Mac OSX to a Windows Active Directory Domain. Apple has made it easy to allow users to bind their macs to a windows domain with relative ease. The following video show how to bind OSX Mavericks to …
This video shows how to quickly and easily add an email signature for all users on Exchange 2016. The resulting signature is applied on a server level by Exchange Online. The email signature template has been downloaded from: www.mail-signatures…

770 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question