Q
Problem solve Get help with specific problems with your technologies, process and projects.

Create several response documents after main doc is created

I have a database that is used to track ongoing Projects. It is only a repository that keeps all the documents that pertain to the project itself (i.e. training documents, project plan, QA documents and several other documents that are created from several groups).

When a Project Lead creates the main document (this doc contains the high level info about the project), I want to be able to create several response documents that inherit Project Name and Start and Due Dates when the user saves the main doc. This way the Lead does not have to create all supporting response documents for the other departments.

For example:

Main(Project Info)--- 
   Project Plan--- 
   Training Document --- 
   Meeting Notes --- 
   Other supporting docs 

Do you have any suggestions that can get me going in the right direction?

Use LotusScript in the Postopen event of the Main form. Something like this:

Sub Postopen(Source As Notesuidocument) 
        Const ITEMSTOCOPY = 
{ProjTitle,StartDate,DueDate} ' fill in your fields here 
        Const RESPONSEFORMS =
 {ProjPlan,Training,MeetingNotes,...} ' use form aliases here! 
        Dim db As NotesDatabase 
        Dim docParent As NotesDocument 
        Dim docNew As NotesDocument 
        Dim item As NotesItem 
        Dim forms, itemNames 
        
        Set docParent = Source.Document 
        Set db = docParent.ParentDatabase 
        forms = Split(RESPONSEFORMS, ",") 
        itemNames = Split(ITEMSTOCOPY, ",") 
        Forall formName In forms 
                Set docNew = db.CreateDocument 
                docNew.Form = formName 
                docNew.MakeResponse docParent 
                Forall itemName In itemNames 
                      
  Set item = docParent.GetFirstItem(itemName) 
                        If Not (item Is Nothing) Then 
                                
Call item.CopyItemToDocument(docNew, itemName) 
                        End If 
                End Forall 
                docNew.Save False, False, True 
        End Forall 
End Sub

However, you are setting yourself up the problem of maintaining the values in these response documents when the corresponding values in the main document changes. If you can combine any of these with the main document you will save yourself some trouble. Either that, or use @GetDocField(@Text($REF); ...) in the response documents to look up the fields you wanted to copy. Maintaining consistent copied data in the response documents is possible but difficult unless you can be sure only one person at a time is editing documents in a particular project.

Do you have comments on this Ask the Expert question and response? Let us know.

Dig Deeper on LotusScript

Have a question for an expert?

Please add a title for your question

Get answers from a TechTarget expert on whatever's puzzling you.

You will be able to add details on the next page.

Start the conversation

Send me notifications when other members comment.

Please create a username to comment.

-ADS BY GOOGLE

SearchWindowsServer

Search400

  • iSeries tutorials

    Search400.com's tutorials provide in-depth information on the iSeries. Our iSeries tutorials address areas you need to know about...

  • V6R1 upgrade planning checklist

    When upgrading to V6R1, make sure your software will be supported, your programs will function and the correct PTFs have been ...

  • Connecting multiple iSeries systems through DDM

    Working with databases over multiple iSeries systems can be simple when remotely connecting logical partitions with distributed ...

SearchDataCenter

SearchContentManagement

Close