Show/Hide Toolbars

Therefore Programming Interface 3.0

 

This Function is called by the Thereforeā„¢ Workflow Engine, every time an automatic Instance of type "Call COM DLL" is executed.

 

public void ProcAutomaticInst([in] int nInstanceNo, int nTokenNo, string bstrTenant, string bstrParams)

 

Arguments

 

nInstanceNo

The Instance number which is currently executed.

 nTokenNo

         The token number. Default value 0. This is only used if the workflow task is in a splitted part of the workflow process.

 bstrTenant

         The tenant name the workflow instance belongs to.

 bstrParams

         The settings returned in ShowSettingsDlg.

 

Return

 

No return Value.

 

 

Remarks

 

Please note that this function has to call TheWInstance.FinishCurrentTask on success.

Otherwise the Item will not get routed to the next Workflow Task and this function will be called again.

 

C# Sample (Implementing the Function)

public void ProcAutomaticInst(int nInstanceNo, int nTokenNo, string bstrTenant, string bstrParams)

{

   try

   {

      //The configuration contains the target folder

      string strOutputDir = bstrParams;

 

      TheServerClass objServer = new TheServerClass();

      TheIndexData objIxData = null;

      TheWFInstance objInstance = null;

 

 //Set the tenant to the server

 objServer.SetTenant(bstrTenant);

 //Connect with special client type

      objServer.Connect (TheClientType.WorkflowDLL);

 

      //Load Workflow Instance using the nInstanceNo

      objInstance = new TheWFInstanceClass();

      objInstance.Load (objServer, nInstanceNo);

 

      //Get the Main Workflow Docuement

      TheWFDocument wfDoc = objInstance.GetLinkedDocAt(0);

            

      //Get the Index Data of Main Doc

      objIxData = new TheIndexData();

      objIxData.Load(wfDoc.DocNo, 0, objServer);

 

      //Dump index data to TXT File

      string strHostOutput = objIxData.ToString();         

            

      string strFilename = strOutputDir + "\\" + nInstanceNo.ToString() + ".txt";

      System.IO.TextWriter objTextWriter = new System.IO.StreamWriter(strFilename);

      objTextWriter.Write(strHostOutput);

      objTextWriter.Close();

 

      //On success route Workflow Instance to the Next Task

      //so first of all get the next Task Number

      TheWFTransition objTrans = objInstance.GetTransitionAt(0);

      int nNextTaskNo = objTrans.TaskToNo;

      TheWFTask objTask = objInstance.GetNextTaskNo(nNextTaskNo);

      int nNextUserNo = 0;

      int nNextUserType = 0;

 

      if (objTask.GetChoicesCount() > 0)

      {

         TheWFChoice  objChoice = objTask.GetChoiceAt(0);

         nNextUserNo = objChoice.UserNo;

         nNextUserType = objChoice.UserType;

      }

 

      //Claim the Instance before routing

      objInstance.ClaimInstance(objServer);

 

      //Success - Finsh Current Task and route Instance to the next Task

      objInstance.FinishCurrentTask (objServer, nNextTaskNo, nNextUserNo, nNextUserType,"");

 

      if (objServer != null)

         objServer.Disconnect();

   }

   catch (Exception e)

   {

      objLog.WriteEntry("WF Exception: " + e.Message, EventLogEntryType.Error);

   }

   

}

 

See Also:

For Information about Debugging such Workflow Extension DLL see: Debugging the Thereforeā„¢ Rights Server

Ā© 2023 Therefore Corporation, all rights reserved.