One of the things we do pretty frequently is allow users to send notifications with links to views/folders from various applications. This is usually to let someone know that data has changed in the folder, or that a flag has been set on the folder configuration document to indicate a change of status for the group of documents contained in the folder. The problem is, if you send a doclink to a view, it opens with the default navigator, rather than in the frameset that you've designed to contain navigation. I've gotten around this by making use of Julian's excellent DXL button creator class.
First, copy the code into a script library (or use as is in .lss format). In the Globals of each view/folder, include the script library, and add this sub:
Sub CreateButton(db As notesdatabase, thisv As notesview, mailDoc As notesdocument,
body As notesrichtextitem, label as string, frameName as string)
On Error Goto errhand
Dim button2 As New RichTextButton
Dim result As String
Dim openDatabaseString As String
Dim openViewString As String
Dim stringToPass As String
Dim frameToPass As String
Dim filepath As String
Dim viewName As String
filepath = Cstr(Replace(db.filepath, "\", "\\"))
viewname = Cstr(Replace(thisV.Name, "\", "\\"))
openDatabaseString = |@Command( [FileOpenDatabase]; "| + db.server + | ":"| + filepath + | ");|
openViewString = |@Command([OpenView]; "| + viewName + |");|
frameToPass = |@SetTargetFrame("| + frameName + |");|
stringToPass = openDatabaseString & Chr(13) & Chr(10) & "@UpdateFormulaContext;" & _
Chr(13) & Chr(10) & frameToPass & Chr(13) & Chr(10) & openViewString
'** append a Formula button to the body
Call button2.SetLabel(label)
Call button2.SetEdgeType(RTB_SQUARE)
Call button2.SetButtonLanguage(RTB_FORMULA)
Call button2.SetCode( stringToPass )
Call body.AddNewline(1)
result = button2.AppendButton(body)
If (result <> "") Then
Call body.AppendText("There was an error creating the button. " & result)
End If
Call maildoc.Save(True, True)
Exit Sub
errhand:
Msgbox "CreateButton error at line " & Erl & ": " & Error
Exit Sub
End Sub
This LotusScript was converted to HTML using the ls2html routine,
provided by Julian Robichaux at nsftools.com.
Here's what our action bar button looks like:
Sub Click(Source As Button)
On Error Goto errhand
Dim s As New notessession
Dim w As New notesuiworkspace
Dim db As notesdatabase
Dim thisV As notesview
Dim mailDoc As notesdocument
Dim body As notesrichtextitem
Set db = w.currentdatabase.database
Set thisV = w.currentview.view
Set mailDoc = db.createdocument
mailDoc.Form = "Memo"
mailDoc.Subject = thisV.Name & " is ready for your review."
mailDoc.SendTo = "Esther Strom"
Set body = New notesrichtextitem(mailDoc, "Body")
Call body.appendtext(s.commonusername & " has indicated that the " & thisV.Name & _
" catalog is ready for MarComm review. " )
Call body.addnewline(2)
'create button here
Call CreateButton(db, thisv, mailDoc, body, "Open Bid Folder", "contentFrame")
Call mailDoc.Send(False)
Call maildoc.RemovePermanently(True)
Msgbox "MarComm has been notified"
Exit Sub
errhand:
Msgbox "Info Ready for MarComm error at line " & Erl & ": " & Error
Exit Sub
End Sub
This LotusScript was converted to HTML using the ls2html routine,
provided by Julian Robichaux at nsftools.com.
The recipient then receives a nicely-formatted email (if you bother to do any formatting) containing a button that will open the folder in the context of the frameset as intended.
Show-n-tell thursday
Show-n-tell Thursday