Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations dencom on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

How to create new document from template with @functions?

Status
Not open for further replies.

t9914

IS-IT--Management
Jun 11, 2002
4
FI
I'm thinking about to make agent to create new document and retrieve data with @Dblookup from different databases.

I have different document types ready to get data but I would like to automate things as much as possible.

How can I create new document from template (for example "Component Pulp" form) with @functions (or with code if necessary)?

I am working with Notes 6.
 
You will not be able to automate much with functions - they only work "client-side" (because only a client can interpret them correctly). Since you mention an agent, I assume you want something that will run during the night, or at scheduled intervals.

To do so you need to use Script.
By using Script, you can create a new document in the database and fill in all the fields. You have to write the code for every field to fill.
Then, before saving your new document, you write a line setting the Form field to the value of the form that needs to be used when someone opens the document.
Lastly, you save the document, then (probably) go on to creating the next one.

Sample code would look like this :
Code:
dim session as new notessession
dim db as notesdatabase
dim doc as notesdocument

set db = session.currentdatabase
set doc = db.createdocument
'set various fields here
'
'now set the form to be used
doc.form = "Component Pulp"
'finally, save the document
call doc.save(true,false,true)

Hope this helps,

Pascal.
 
By the way, if you just want a button to create a document of the same type (or of any type in the database, for that matter), you can always use the @Command([Compose],formname) formula.

Pascal.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top