• Create Document

    By Miguel E Gonzalez 2 decades ago

    Hi…



    I have a big problem.



    I want to create one “form” document and when I click in Send automatically create 5 more. How I can do this??’



    Thanks

    • "A big problem"

      By Marko Bonaci 2 decades ago

      Hi Miguel,

      what do you want to acomplish, you'll have to explain more clearly.



      Why are you using "Send"?



      Do you maybe have some special characters displayed in a view (I have a character in my language which, when displayed in a view, duplicates the document display)?



      Hope this helps,

      Mb¤

      • Ok

        By Miguel E Gonzalez 2 decades ago

        Yes I want to copy the document 5 times but with some fields differences when the user click send or with an agent.

        • The big problem

          By Marko Bonaci 2 decades ago

          Miguel,

          to copy the document use something like this:

          <br/>
          Dim s As New NotesSession<br/>
          Dim doc1 as NotesDocument, doc2 As NotesDocument, ...<br/>
          


          'Repeat this block for each document:<br/>
          Set doc1 = doc.CopyToDocument( s.CurrentDatabase )<br/>
          doc1.FieldYouWantToChange = &quot;NewValue&quot;<br/>
          Call doc1.Save( True, False, True )<br/>
          





          If you want it done when the doc is mailed place the code in Postsend form event, you don't need an agent.



          Tell me, Miguel, how this relates to the project Code library?



          Hope this helps,

          Mb¤

          • Formula

            By Miguel E Gonzalez 2 decades ago

            Hi… Thanks for everything…. but there is no way I can do this with formula instate of lotuscript?¿



            Regards



            Miguel Gonzalez C

          • By Miguel E Gonzalez 2 decades ago

            Hey sorry to bother but this code in postsend doesn’t work

            • LotusScript

              By Marko Bonaci 2 decades ago

              Miguel,

              I didn't know that you're not experienced in using LS.



              Sub Postsend(Source As Notesuidocument)

              Dim s As New NotesSession<br/>
              Dim doc As NotesDocument<br/>
              Dim doc1 As NotesDocument, doc2 As NotesDocument, doc3 As NotesDocument, doc4 As NotesDocument, doc5 As NotesDocument<br/>
              <br/>
              Set doc = Source.document<br/>
              <br/>
              'Repeat this block for each document:<br/>
              Set doc1 = doc.CopyToDocument( s.CurrentDatabase )<br/>
              doc1.FieldYouWantToChangeOnDoc1 = &quot;NewValue&quot;<br/>
              Call doc1.Save( True, False, True )<br/>
              <br/>
              'Like this:<br/>
              Set doc2 = doc.CopyToDocument( s.CurrentDatabase )<br/>
              doc2.FieldYouWantToChangeOnDoc2 = doc.fieldNameWhoseValueYouWant(0)<br/>
              Call doc2.Save( True, False, True )<br/>
              



              End Sub

              • Replace one line

                By Marko Bonaci 2 decades ago

                This line:

                Set doc1 = doc.CopyToDocument( s.CurrentDatabase )



                With this one:

                Set doc1 = doc.CopyToDatabase( s.CurrentDatabase )



                My mistake,

                Mb¤

                • OK

                  By Miguel E Gonzalez 2 decades ago

                  Ok Thanks ..



                  Regards….



                  Miguel