我有一个网页表单,当按下按钮时,应从字段中提取名称列表并发送邮件。邮件没有发送....这是莲花脚本...提前感谢
Sub Click(Source As Button)
Dim s As New NotesSession
Dim ws As New NotesUIWorkspace
Dim db As NotesDatabase
Dim view As NotesView
Dim doc As NotesDocument
Dim mdoc As NotesDocument
Dim ddoc As NotesDocument
If ws.CurrentDocument.IsNewDoc Then
Call ws.CurrentDocument.Save
Set db = s.CurrentDatabase
Set view = db.GetView("deptLookup")
Set doc = ws.CurrentDocument.Document
dept$ = doc.ProcDeptAssoc(0)
Set ddoc = view.GetDocumentByKey(dept$)
If ddoc Is Nothing Then
Msgbox "Department not found"
Else
Set mdoc = New NotesDocument(db)
mdoc.Subject = "Comment made on procedure " + doc.ProcNo(0) +" - "+doc.ProcName(0)+ " by " + doc.CreatedBy(0)
Dim rtitem As New NotesRichTextItem(mdoc, "Body")
Call rtitem.AppendText("Requires the approval of " +doc.approver(0)+", click the link and the approve or deny the request. ")
Call rtitem.AddNewline(1)
Call rtitem.AppendDocLink(doc, "CommentsDoc")
receipients = ddoc.NotifyName
mdoc.SendTo = receipients
mdoc.Send(False)
End If
Else
Call ws.CurrentDocument.Save
End If
ws.CurrentDocument.Close
End Sub
答案 0 :(得分:0)
如果您使用表单而不是XPage,则需要将代码放在代理中,并将该代理设置为表单的 WebQuerySave 代理。从Web访问时,按钮下的LotusScript将无法运行。
此外,您无法在后端代码中使用NotesUIWorkspace
等UI类。
答案 1 :(得分:0)
您可以将该Lotusscript代码移动到具有触发器“代理列表选择”并且目标为“无”的代理,并从Web表单中使用带有@command的@formula(非lotusscript)按钮:
<强> @Command([RunAgent]; “NAME_OF_YOUR_AGENT”); 强>
Panu Haaramoroperties说的是正确的,因为按钮中的Lotusscript click事件不能从Web表单中起作用,但@commands可以正常工作。
当他说你必须替换NotesUIWorkspace引用时,他也是对的。您可以开始使用:
<强> s.documentContext 强> 代替 的 ws.CurrentDocument 强>