I have followin LN script :
Dim doc As Notesdocument
Dim doc2 As Notesdocument
Dim uidoc As NotesUIDocument
Dim workspace As New NotesUIWorkspace
Dim session As NotesSession
Set session = New NotesSession
Dim db As NotesDatabase
Set db = session.CurrentDatabase
Set uidoc = workspace.CurrentDocument
Set doc = uidoc.Document
uind = doc.GetItemValue(“uind”)
Set docAutor =db.GetDocumentByUNID(uind(0))
Call workspace.DialogBox _
("Dialog Box", True, True, False, False, False, _
False, "Dialog Box", doc2)
EndSub
After execute this code, it doesn’t display bialog box with my document. I recive message:
“DialogBox cannot be used in this context; a document must be selected”.
What’s wrong?
Subject: corrected code
DialogBos in LN
Dim doc2 As NotesdocumentDim uidoc As NotesUIDocument
Dim workspace As New NotesUIWorkspace Dim session As NotesSession
Set session = New NotesSession Dim db As NotesDatabase
Set db = session.CurrentDatabase Set uidoc = workspace.CurrentDocument
Set doc = uidoc.Document uind = doc.GetItemValue(“uind”)
Set doc2 =db.GetDocumentByUNID(uind(0)) Call workspace.DialogBox _
(“Dialog Box”, True, True, False, False, False, _
False, “Dialog Box”, doc2)
Subject: RE: corrected code
DialogBos in LN
Is it possible that the uind wasn’t found so doc2 is still nothing.
Try surrounding in a if or running through debugger to ensure that doc2 is being set.
i.e.
Set doc2 =db.GetDocumentByUNID(uind(0))
If doc2 is nothing then
msgbox “The UNID " + uind(0) + " was not found”
else
Call workspace.DialogBox _
(“Dialog Box”, True, True, False, False, False, _
False, “Dialog Box”, doc2)
end if
HTH - Rufus
Subject: RE: corrected code
DialogBos in LN
I have the same message. If I debug LN script, I see, Set doc2 =… is setting, and in doc I have correct document. Problem is when execute Dialogbox :(.
Subject: RE: corrected code
DialogBos in LN
So doc2 is definately a NotesDocument, with properties expanding below it in the variables window?
Subject: RE: corrected code
DialogBos in LN
yes
Subject: RE: corrected code
DialogBos in LN
Where actuallis your button that runs the script?
Subject: RE: corrected code
DialogBos in LN
It’s no button but hotspot and it’s on document doc - seting in code as current document.
Subject: DialogBos in LN
Bobb,
You haven;t set doc2 to a document.
You normally only put the last parameter in if you are bringing up a dialogbox from a view, or don;t know if a doc will be available.
Replace your dim statement with Dim doc2 as New NotesDocument(db) - after setting db of course!
HTH
Mike
Subject: RE: DialogBos in LN
I have set doc2. I put coreccted code. So what’s wrong ?
Subject: RE: DialogBos in LN
Debug it.
Is doc2 set to a document when you get to your DialogBox line??
Subject: RE: DialogBos in LN
Yes, in doc2 i have correct docucment. When i debug script, i see, in doc2 is correct document.
Subject: RE: DialogBos in LN
Don’t know if I can help, but here is one of my buttons that works, maybe you could copy the format, I’ve had problems with parameters on Dialog Boxes before, now I just put them all in!
Dim s As New NotesSession
Dim ws As New NotesUIWorkspace
Dim db As NotesDatabase
Dim uidoc As NotesUIDocument
Dim doc As NotesDocument
Set uidoc = ws.CurrentDocument
Set doc = uidoc.Document
Set db = s.CurrentDatabase
Set tmpdoc = db.CreateDocument
Call ws.DialogBox("diaScheduler",True,True,True,True,True,True,"TITLE", [doc OR tmpdoc], False, True, False)
I have included both variations, one using the current document, and one using a newly created one. Both work in my database.
Hope this helps!
Subject: RE: DialogBos in LN
Thx very much! It works well !
Subject: RE: DialogBos in LN
Thx. What’s diaScheduler? It’s form or … ?
Subject: RE: DialogBos in LN
diaScheduler is the Form you are displaying as a DialogBox
Subject: Example from help
there is example from help: Dim db As NotesDatabase
Dim s As New NotesSession
Dim workspace As New NotesUIWorkspace
Dim view As NotesView
Dim doc As NotesDocument
Set db = s.CurrentDatabase
Set view = db.GetView( “By Category” )
Set doc = view.GetFirstDocument
Call workspace.DialogBox _
(“Dialog Box”, True, True, False, False, False, _
False, “Dialog Box”, doc)
Call doc.save (True, False)
If i set this code below my button I become the same message (i set name my view :)).