• workflow question

    By ryan e messier 2 decades ago

    how or what can I do to have a specific workflow automatically load when creating a new document? I only have one workflow that I want users to use and I want to skip the step of them choosing it by the "choose workflow" button?

    • By Vilhjalmur Helgason 2 decades ago

      In (Globals) - (Optins)yourFormName add:

      Use "wfNote"



      and in the PostOpen event of your form add:



      Sub Postopen(Source As Notesuidocument)

         Dim wfName As String<br/>
      


         On Error Goto errorHandling<br/>
      


         wfName = &quot;YourWorkflowName&quot;<br/>
      


         Call source.document.ReplaceItemValue( WF_FIELD_WORKFLOW, wfName )<br/>
         Call source.document.ReplaceItemValue( WF_FIELD_ACTIVE_TASK, &quot;&quot; )<br/>
         Call WorkflowInitiate( source.Document.GetItemValue(<br/>
      

      WF_FIELD_WORKFLOW )(0), source.Document )

         source.Refresh<br/>
      


         Exit Sub<br/>
      

      errorHandling:

         Print &quot;Error in Queryopen: &quot; &amp; Error$<br/>
         Exit Sub<br/>
      

      End Sub



      where you replace wfName = "YourWorkflowName" with your workflow name, and Sub Postopen(Source As Notesuidocument) and End Sub are not included in the paste :)