Help needed with LotusScript, please

MorningI really need some help to get started on the following, I am really not strong in LS.

I have a database that stores meetings held, I need to create a response document automatically (diff form) if the meeting date is passed. This repsonse doc needs to be created in the background (assume via agent) and the mailed to the relevent meeting presenters. I really do not know how to start. I can get it right with formula but this will not work running in background.

Any advice would really be appreciated.

C

Subject: Help needed with LotusScript, please.

Hi,

you can find below a sub to create response and with mail function, copy it to your agent to declaration part or to script library and call it in example way.

'This is a short function to create response document and send it to recipients

'Input parameters are:

'-origDoc is document, which should be the parent

'recipients is list of mail recipients, who need to get response documents

%REM

Example of calling of sub:

recipients(0) = “John”

recipients(1) = “James”

call createRespAndMailIt(origDoc, recipients)

%END REM

'***************************************************************************************************

Sub createRespAndMailIt(origDoc As NotesDocument, recipients As Variant)

Dim session As New NotesSession

Dim db As NotesDatabase

Dim respDoc As NotesDocument



Set db = session.CurrentDatabase

Set respDoc = db.CreateDocument



Call respDoc.MakeResponse( origDoc)

respDoc.Form = "Response" 				'Name of your form

Call respDoc.Save( True, True )





'send document to recips	

Call respDoc.Send( True, recipients)

End Sub

'***************************************************************************************************

HTH

István

Subject: RE: Help needed with LotusScript, please.

Hi Many thanks for the response.Please could you confirm where I place this in agent and the best way to declare the recipients?

RE: Help needed with LotusScript, please.

Posted by Istvan Csuport on 6.Jun.05 at 04:36 using a Web browser

Category: Domino DesignerRelease: 6.5.2Platform: Windows 2000

Hi, you can find below a sub to create response and with mail function, copy it to your agent to declaration part or to script library and call it in example way. 'This is a short function to create response document and send it to recipients

'Input parameters are: '-origDoc is document, which should be the parent

'recipients is list of mail recipients, who need to get response documents

%REM

Example of calling of sub: recipients(0) = “John”

recipients(1) = “James” call createRespAndMailIt(origDoc, recipients)

%END REM

Thanks again C

Subject: RE: Help needed with LotusScript, please.

I can advise to you next steps:

-Create a new scheduled agent in db

-copy only the clear text of sub without comments and paste it into declaration part, and designer will make atomatically new sub in agent under the events

-write your code into Initialize event, which will select parent document from db, and in your code call this sub with parameters (As I wrote in comments)

Recipients can be filled out in many ways, if you have it somewhere in profile document field, call it directly from field “recipients = profileDoc.GetItemValue(“YourField”)”, if you need to write it directly in code, use string list, for example if you have three recipients:

dim recipients(2) as string

recipients(0) = “John”

recipients(1) = “James”

recipients(2) = “Bobby”

call createRespAndMailIt(origDoc, recipients)

Urgent Note:

Accept my apology please, I made a little mistake in sub, parameter recipients must be string list, not variant, please rename it in sub:

Sub createRespAndMailIt(origDoc as NotesDocument, recipients as string)

All others will work without touch.

By

István

Subject: RE: Help needed with LotusScript, please.

HiThanks again for all your help, where exactly do I put this?? In delcarations, it keeps giving me an error??

dim recipients(2) as string

recipients(0) = “John”

recipients(1) = “James”

recipients(2) = “Bobby” call createRespAndMailIt(origDoc, recipients)

Thanks again. C

Subject: Help needed with LotusScript, please.

Use a scheduled agent, you can use the document object in LS to create a response document, there’s a method for this. eg Call doc.MakeResponse(doc) check the designer help for more information. You can also use the doc.Send method to email the document to the relavent people.