Workflo agent for web

I have an application that will email a group once it has been submitted this is done via lotus script on the querysave event, I am aware that this will not work on the web however I need that functionality. Here is the code:Sub Querysave(Source As Notesuidocument, Continue As Variant)

Dim session As New notessession

Dim db As notesdatabase

Dim dc As notesdocumentcollection

Dim maildoc As notesdocument

Dim doc As notesdocument

Dim rtitem As notesrichtextitem

Dim agentlog As New NotesLog("Agent Log")

Dim flag As Integer

Dim SendTo As Variant

Dim CopyTo As Variant	

Dim BlindCopyTo As Variant	

Dim Subject As String

Dim body As String

Dim wmail As String

Dim sprin As String

Dim mailtext As String

Dim i As Integer



If Trim(Source.FieldGetText("GNewsPublishDate"))="" Then

	Messagebox "What is the Publish Date?", MB_OK

	source.gotofield("GNewsPublishDate")

	continue=False 

	Goto EXITQUERYSAVE

End If



If Trim(Source.FieldGetText("GNewsDeleteDate"))="" Then

	Messagebox "What is the Un-Publish Date?", MB_OK

	source.gotofield("GNewsDeleteDate")

	continue=False 

	Goto EXITQUERYSAVE

End If



If Trim(Source.FieldGetText("GNewsHeadline"))="" Then

	Messagebox "What is the articles Headline?", MB_OK

	source.gotofield("GNewsHeadline")

	continue=False 

	Goto EXITQUERYSAVE

End If



If source.isnewdoc Then

	If source.FieldgetText("GTypeItem") = "News Item" Then

		Set db = session.currentdatabase

		Set maildoc = New notesdocument(db)

		Set doc = source.document

		Call source.fieldSetText("GNewsAuthors", "[NewsEditor], [Develop]")

		mailtext = "Please follow the included document link to a new Announcement which you have been asked to publish.  Thank you"

		maildoc.form = "Memo"

		maildoc.CopyTo = ""

		maildoc.BlindCopyTo = ""

		maildoc.Subject = "Announcement Approval Request"

		maildoc.principal  = "Automated Portal Announcement Notification"

		Set rtItem = mailDoc.CreateRichTextItem("Body")

		Call rtItem.AppendText(mailtext)

		Call rtItem.AddNewLine(2)

		Call rtItem.AppendDocLink(doc, "Double-click to open document")

		Call maildoc.send(False,source.fieldgettext("GApprovers"))

	Else

		If source.fieldgettext("GTypeItem") = "Help Desk Item" Then

			Call source.fieldSetText("GNewsAuthors", "[HelpDesk], [Develop]")

		End If

	End If

End If	

EXITQUERYSAVE:

End Sub

Other then the actually sending, I will need to determine based on OU which one of the HR’s will receive the email, but I can try to figure that out later…NOTE: I will need to folks that receive the email to be able to edit the document if necessary all this through the web…

Subject: Workflo agent for web

Ray,

Look up help for DocumentContext Property, this will replace the UIDocument in your agent.

Subject: Workflo agent for web

also look at the discussion db template that comes with Notes, there is lot of good code there too.

Subject: Workflo agent for web

Won’t it be web link if you just append URL path to the document as text to the mail body? Call rtItem.AppendText(“http://server.com/db.nsf/view1/doc1?opendocument”) instead of appending doc link (Call rtItem.AppendDocLink …)?

If you want to enhance your workflow application with Sametime functionality and send Sametime message with weblink to intended recepients, you can use STAgent: