Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations IamaSherpa on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Lotus notes run return a value from a LotusScript in a view

Status
Not open for further replies.

RodP

Programmer
Jan 9, 2001
109
GB
Hi Everyone,

I've found a nifty liitle agent that tells you which folder an email is in from say 'all documents'. This is the code:

(from:
Code:
Dim sess As New notessession
Dim db As notesdatabase
Set db = sess.currentdatabase
db.FolderReferencesEnabled = True
Dim docs As NotesDocumentCollection
Dim doc As NotesDocument
Set docs = db.unprocesseddocuments
Set doc = docs.getfirstdocument

While Not(doc Is Nothing)
Forall folder In doc.FolderReferences
If folder <> "" Then
Msgbox doc.subject(0) & " -> folder: " & folder
End If
End Forall
Set doc = docs.GetNextDocument(doc)
Wend
[code/]

This works fine but I'd like to make it so that it's combined into a view.  I've copied the 'all documents' view  and tried to use the @command([toolsrunmacro];"<name of agent>")  but it throws up an error and so I don't think this is the way to do it.

Please could anyone adivse?

Many thanks in advance.

RodP
 
What error does the popup say ?

By default, Agents are configured to work on Selected Documents, and rather counter-intuitively, that is not a valid setting for triggering it via button in a view.

Reset the agent to run on All Documents in Database and try again if you haven't already.

Pascal.


I've got nothing to hide, and I'd very much like to keep that away from prying eyes.
 
Hi pmonett,

It says '@command and other UI functions are not allowed in this context'. It sounds like I can't use the @command. Plus also, I now can't get back into the design of it as when ever I click on it it gives this error and jumps back to the previous view i was in. Annoying!! Do you know how to delete a view using an agent (bypassing this error)?

cheers

RodP
 
You're using an @Command function in an agent ? Then you have to set the agent target to "None".

Pascal.


I've got nothing to hide, and I'd very much like to keep that away from prying eyes.
 
Hi Pascal,

No, I was trying to use an @command in a formula for a column in a design view called 'all documents (2)', not an agent.

Hope this clarifies things

thanks

Rodp
 
You cannot use @commands in column formulas.

Pascal.


I've got nothing to hide, and I'd very much like to keep that away from prying eyes.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top