About Duffbert...

Duffbert's Random Musings is a blog where I talk about whatever happens to be running through my head at any given moment... I'm Thomas Duff, and you can find out more about me here...

Email Me!

Search This Site!

Custom Search

I'm published!

Co-author of the book IBM Lotus Sametime 8 Essentials: A User's Guide
SametimeBookCoverImage.jpg

Purchase on Amazon

Co-author of the book IBM Sametime 8.5.2 Administration Guide
SametimeAdminBookCoverImage.jpg

Purchase on Amazon

MiscLinks

Visitor Count...



View My Stats

« Book Review - The Taking by Dean Koontz | Main| How to Code the "Submit" Button when Using JavaScript Form Validation »

How to Use a LotusScript Print Statement to Open Another Web Page in a WebQuerySave Agent

Category Software Development

This is something I want to post out on my blog so I can find it when I need it...  From the KnowledgeBase...

How to Use a LotusScript Print Statement to Open Another Web Page in a WebQuerySave Agent

Doc Number:  1089692

Problem
How can a WebQuerySave agent be programmed to go to another URL after a document is submitted?

Content
A WebQuerySave event or $$QueryOpenAgent field can be used to call a LotusScript agent that contains a Print statement like the following as its last line of code:

Print "[http://www.site.com/dbname.nsf/viewname?openview]"

The syntax is Print "[ URL ]".  The URL can be relative to the server's Data directory or absolute.

The print command will not do anything in a script called from a WebQueryOpen event or $$QueryOpenAgent field.  

You can also execute a Print "[ URL ]"  redirect from a button, hotspot, or URL by calling the agent containing the Print statement in the following ways:

@URLOpen("/database/agentname?OpenAgent")

@Command([ToolsRunMacro]; "agentname")

JavaScript

window.location="/database/agentname?OpenAgent")

Comments

Gravatar Image1 - Hi,
I desperately need help.
On the browser I need to access control documents, based on a particular field value. The user should be a member of a group defined in another database. If he is not then the document will not open for him.
This concept works fine on the client but am not able to make it work on the web. Am new to scripting browser applications. So what am doing is pasting the code that I used in the client application and please help me with the browser version.

Thank u in advance

Sub Queryopen(Source As Notesuidocument, Mode As Integer, Isnewdoc As Variant, Continue As Variant)
Dim doc As NotesDocument
Set doc = Source.Document
' On Error Goto lblErrs
If Left(doc.SegmentType(0), 12) = "Naval Vessel" Then
Dim s As New notessession
Const NotesMacro$ = "@Name([ABBREVIATE]; @UserName)"
l_username = Evaluate(NotesMacro$, doc)

Dim dlcdb As notesdatabase
Dim ccdb As New Notesdatabase("","")
Dim view As Notesview
Dim ccdoc As Notesdocument

Dim path As String

Dim key1 As String
Dim key2 As String
Dim TargetDb As String
Set dlcdb = s.CurrentDatabase

path = Left$(dlcdb.FilePath,Instr(1,dlcdb.FilePath,"\xl",2)-1)
TargetDb=path+"/db.nsf"
Opentest = ccdb.Open ( dlcdb.Server, TargetDb)
If Not Opentest Then
Print "The database could not be opened. "
Continue = False
Exit Sub
End If

key1 = "Access Group"
Set view = ccdb.GetView("Group")
Set ccdoc = view.GetdocumentbyKey(key1,True)

If ccdoc Is Nothing Then
Messagebox "The access group could not be found in the Database. ", MB_OK, "Document Locked."
Continue = False
Exit Sub
End If

Dim dc As Notesitem
Set dc = ccdoc.GetFirstItem("Group_Members")
Forall l_names In dc.Values
If l_names = l_username(0) Then
Continue = True
Exit Sub
End If
End Forall
Messagebox "This document contains technical data whose export is restricted"+Chr(10)+Chr(10)+"Please contact TQM Department if you are receiving the message in error.", MB_OK, "WARNING !!!!!"
Continue = False
Exit Sub
End If

End Sub

Gravatar Image2 - Is it possible to use @Command([ToolsRunMacro]; "agentname") to run an agent in another database? for example:
temp:= "dbname" + /+ "agentname";
@command([ToolsRunMacro]; temp);

Gravatar Image3 - Will that redirection be a 301/302?

Post A Comment

:-D:-o:-p:-x:-(:-):-\:angry::cool::cry::emb::grin::huh::laugh::lips::rolleyes:;-)

Want to support this blog or just say thanks?

When you shop Amazon, start your shopping experience here.

When you do that, all your purchases during that session earn me an affiliate commission via the Amazon Affiliate program. You don't have to buy the book I linked you to (although I wouldn't complain!). Simply use that as your starting point.

Thanks!

Thomas "Duffbert" Duff

Ads of Relevance...